Search code examples
jqueryfadeinfadeoutslidedownslideup

jQuery slideUp/Down and fadeOut/In stops halfway


Here's the fiddle:

http://jsfiddle.net/4mmk2/

Rapidly clicking the button will cause the animation to pause halfway. I suspect it's the stop() function's problem but I can't find a way to fix it. By the way, I use stop to prevent jQuery from putting all the sliding animations in the queue.


Solution

  • toggle() is deprecated you can try slideToggle():

    $('a').click(function(e) {
        e.preventDefault();
        $('div').stop(true,true).slideToggle()
    })
    

    http://jsfiddle.net/4mmk2/3/