how to properly use jquery .stop() ?

Posted by GaVrA on Stack Overflow See other posts from Stack Overflow or by GaVrA
Published on 2010-04-02T15:05:07Z Indexed on 2010/04/02 15:13 UTC
Read the original article Hit count: 368

Filed under:
|

Hello!

On this page:

http://www.arvag.net/old/smsbox.de/

when you hover over "Informationen" and "Über uns" you get sub menu shown. When you move mouse away it hides. Normally i have problem with jquery making queue for every single hover i make, and then i just keeps on animating all those hovers. I tried to implement stop() but just cant get it to work properly.

This is the code i am using:

<script type="text/javascript">
    //<![CDATA[
    $(function(){
        $('#nav_menu > .center > ul > li').hover(function() {
            $(this).children('ul').slideToggle('slow');
        },function(){
            $(this).stop(true,true).children('ul').slideToggle('slow');
        }).click(function(){
            return false;
        });
    });
    //]]>
</script>

Thanks!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about stop