Adam
Adam

Reputation: 9049

slidedown and slideup looping bug in firefox

http://www.queness.com/post/1047/easy-to-style-jquery-drop-down-menu-tutorial#comment-7912

I have a menu exactly like the one on queness, so check out the demo to see the issue. Basically, if you're using firefox and your mouse goes up and off the button vertically you can get the slidedown and slideup to sort of flicker in a loop. Play around and you'll see it's pretty easy to do.

Is there a way to fix this? For some reason it only happens in firefox.

Thanks

Upvotes: 2

Views: 1592

Answers (1)

Bodman
Bodman

Reputation: 8056

Yeah you can use the stop() function in JQuery, whats happening is its probably queueing up.

http://api.jquery.com/stop/

$(document).ready(function () { 

$('#nav li').hover(
    function () {
        //show its submenu
        $('ul', this).stop(true,false).slideDown(100);

    }, 
    function () {
        //hide its submenu
        $('ul', this).stop(true,false).slideUp(100);         
    }
);
 });

This stops the animation from queueing, check out the parameters of stop() to meet your needs.

EDIT:

Check out http://css-tricks.com/examples/jQueryStop/

Shows the difference in parameters with Stop. True true restarts the animation, which will make it seem glitchy. True , false, allows the animation to finish, but kills the queue.

Upvotes: 1

Related Questions