Joshua Joshua - 3 months ago 13
HTML Question

.fadeOut not working with very simple code

I am trying to make a navigation menu for a blog I am working on, currently I am trying to make it where when the 'Home' tab is clicked on the other two fade out. I do not know why this code is not working as it is a pretty simple few lines of code. I am not going to add in the CSS as I do not believe it will have anything to do with this problem. Thank you!




<div id='bckDrp'>
<div id='nav'>
<ul id='navLst'>
<li class='navOp' id='hme'>Home</li>
<li class='navOp' id='abt'>About</li>
<li class='navOp' id='prt'>Portfolio</li>
</ul>
</div>
</div>





var main = function(){
$('#hme').click(function(){
$('#abt, #prt').fadeOut();
});
}

document.ready(main);

Answer

You aren't actually calling the main function at all.

document.ready(main)

Should be the JQuery format:

$(document).ready(main);