Situation:
- I have a menu, and I need it when an event of
hover
occurs, it display a series of information from its menu - When the mouse is moved to another menu, the displayed information has to be hidden and display information from the other menu.
Problem:
- When I quickly click on the menu links, it sometimes bugs, displaying the contents of 2 or more menus (which did not give me time to hide)
Here is JSFiddle
Here is the code I'm using:
HTML:
<ul class="megamenu">
<li>
<a href="#" data-id="sbc_1">Teste</a>
</li>
<li>
<a href="#" data-id="sbc_2">Teste2</a>
</li>
<li>
<a href="#" data-id="sbc_3">Teste3</a>
</li>
<li>
<a href="#" data-id="sbc_4">Teste4</a>
</li>
</ul>
JS:
$(function(){
var id;
$('.megamenu a').mouseenter(function()
{
id = '#megamenuContent #'+$(this).data("id");
$(id).fadeIn('slow');
})
.mouseleave(function()
{
$(id).hide();
});
});
I would like to know if anyone has any suggestions or any solutions to this problem, in the latter case I will end up opting to use the click
event, but the ideal for my case is to use hover
. >