jQuery - Animation flicker using hover()

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-05-18T15:41:01Z Indexed on 2010/05/18 15:50 UTC
Read the original article Hit count: 195

Filed under:
|
|

I have a setup as described in this question which works perfectly. Essentially a drop down menu grows when you move your mouse over it to expose more options.

There is, however, a small issue. If you move the mouse outside of the #dropdown div and then back in again quickly it constantly fires the mouseenter and mouseleave events causing a never ending cycle of flickering. How can I get around it?

Here is my current jQuery code

$("#dropdown").hover(function() { 
        $(this).stop(true,true).fadeTo('fast',1);
        $("#options").stop(true,true).slideDown();
    }, function() { 
        $(this).stop(true,true).fadeTo('fast',0.1);
        $("#options").stop(true,true).slideUp();
    }
);

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-animation