jQuery .animate chains, callbacks, and .stop(true, true)

Posted by JKS on Stack Overflow See other posts from Stack Overflow or by JKS
Published on 2010-04-21T20:08:42Z Indexed on 2010/04/21 20:13 UTC
Read the original article Hit count: 348

Filed under:
|

So I have a animation chain (.animate().animate().animate()), and on the last .animate(), there is a callback to do some clean-up.

The animation is triggered by the hash in the address changing (#page1, #page2, etc.) -- so when the user changes the history state rapidly, if there is a currently executing animation, it needs to stop so they don't queue up. The problem is, if I add a .stop(true, true), it appears only to jump to end of the currently running animation -- and executes only its callback, if there is one. What I need is for it to jump to the end of all of the chained animations, and fire all of the callbacks (well, really just the last one).

Is this possible somehow? Huge thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about animation