function keeps repeating?
It is a beginners problem I'm sure but I'm making a menu and when hovered, the submenu appear. However, when moving the mouse the submenu keeps fading in and out a few times. Why? Can I stop the function from repeating itself over and over?
- $('#block-menu-primary-links ul:first li.expanded').hover(
function(){
$(this).children('ul').fadeIn(300);
}, function(){
$(this).children('ul').fadeOut(300);
});
With html:
<div id="block-menu-primary-links">
<div class="content">
<ul class="menu">
<li class="expanded active-trail"><a href="over">Over</a>
<ul class="menu">
<li class="leaf first active-trail">
<a href="wat" class="active">Wat</a></li>
</ul>
</li>
</ul>
</div>
</div>