Search code examples
jqueryhovermouseentermouseleave

Hover handlerout check if is hovering something before do something


When I mouseleave I want to change the li_lancamentos a. But, I just want to do that, if when I mouseleave I'm not hovering li_lancamentos again. When I mouseleave from #li_novo_lancamento back to #li_lancamentos again, #li_lancamentos a stills white because of the mouseleave event. I have to put some check on the mouseleave to see if when I mouseleave Im not hovering#li_lancamentos` again.

But, how can I do that?

Here is the fiddle with more detailed explanations: http://jsfiddle.net/tehfo/VNmAU/5/

Thanks!


Solution

  • Maybe you want this:

    $('#li_lancamentos').css({"background-color":"white","border":"1px solid white","border-collapse":"collapse","color":"#616161"});
        $('#li_lancamentos a').css({"color":"#616161"});
    
    $(document).ready(function(){
       $("#li_lancamentos ul a").css("display", "none");
    });
    $("#menu").hover(function(){
       $("#li_lancamentos ul a").css("display", "block");
    });
    

    This will make your menu-links appear and disappear when hovering over the menu. Here is a link to fiddle: jsfiddle.net/VNmAU/11 Is this what you wanted?