Reputation: 2491
This code is used for a dropdown menu, the issue is that when i hover over the li the dropdown opens fine and then when i moved the mouse over the new dropdown div the hover property of the li a is removed, I need the li a background to use the hover properties until the mouse moves away from the li a or dropdown div.
$("ul.nav li").hover(function(){
$(this).find('.dropdown').toggle();
});
This is the menu code I'm using.
<ul class="nav">
<li class="first"><a href="/">HOME</a></li>
<li>
<a href="#">CATEGORIES</a>
<div class="dropdown" style="display: none">test</div>
</li>
</ul>
Upvotes: 0
Views: 109
Reputation: 1255
Instead of using the .hover function, use the mouseenter function tied to the "a" element to trigger the dropdown.
Then use the mouseleave function tied to the higher li element to hide the drop menu.
Upvotes: 0