I’m trying to create an animated dropdown menu using Jquery/CSS and have the animation to make it appear fine, but I need it to hide the drop down menu onmouseout, however just using onmouseout won’t work with the ul, when I hover over an li it triggers it. Having read other posts I though I could use the JQuery mouseleave function but can’t egt it working, can anyone help!?
The menu:
<ul id="navList">
<li><a href="/">Home</a></li>
<li id="about" onmouseover="dropDown();" ><a href="#">About me</a>
<ul id="drop">
<li>What I do</li>
<li>CV</li>
<li>Photo Gallery</li>
</ul>
</li>
</ul>
The function that shows the dropdown:
<script type="text/javascript">
function dropDown ()
{
$("#drop").animate({height:'100px'},300);
$("#drop").animate({opacity:'100'},300);
};
</script>
The function I’m trying to use to hide it:
<script type="text/javascript">
$('#about').mouseleave(function(){
$("#drop").animate({height:'0px'},300);
$("#drop").animate({opacity:'0'},300);
});
</script>
Just Try With The Following :
Script Part :
HTML Part :
I think this may help you to resolve your problem.