Grow your CSS skills. Land your dream job.

JQuery Slidedown and Up

  • # April 28, 2013 at 7:38 am

    Hi guys,

    I’m working on a long menu, the options of which are hidden until the menu is hovered over, whereupon the options are revealed.

    The problem is when the menu is fully open, then hovered away from, then re-hovered over. It jerks either fully open or fully closed.

    This is because if the second stop parameter isn’t set to true then the menu can be “paused” in a half open/half closed state.

    Thanks in advance for any response,

    jQuery(‘#c_menu_wrap’).hover(function() {
    jQuery(this).children(‘#c_menu_int’).stop(true, true).slideDown();
    }, function() {
    jQuery(this).children(‘#c_menu_int’).stop(true, true).slideUp();
    })

    (We can’t use the css transition here as the height needs to be auto due to us not being in control of how many options are in the menu.)

    # April 28, 2013 at 7:46 am

    Oh, and without any “stop” functions, it queues up animations indefinitely!

    I’m basically hoping for a way that, if it is beginning the slideup anim, then hovered over, then it will start sliding down without either first jumping or completing the slideup animation.

    # April 28, 2013 at 9:00 am

    Did you try changing the stop function parameters `.stop( [clearQueue ] [, jumpToEnd ] )` ([ref](http://api.jquery.com/stop/))?

    Maybe try `.stop(true, false)` and see if that does what you want.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".