I’ve read the API documentation on .stop()… http://api.jquery.com/stop/
But I’m still confused as to the difference between the following:
.stop(false, false)
.stop(true, false)
.stop(false, true)
.stop(true, true)
Could someone explain?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When doing animation, there is an animation queue that sequences multiple animations. For example, you could do:
This puts three separate animation items in the animation queue for that object and starts executing the first one.
.stop()is the same as.stop(false, false). It stops the current animation, but does not clear the queue of other animations that may be sequenced to come next and just stops the current animation at its current position..stop(true, false)stops the current animation and does clear the queue of other animations that may be sequenced to come next – again leaving the current animation at its current position..stop(true, true)stops the current animation, clears the queue and jumps to the final animation state as if all animations ran to completion. If you don’t set the second parameter to true, it just stops wherever it happened to be when you calledstop()without jumping to any final value.I find that most of the time, I want
.stop(true, true)to put the object into a known state as if the animation had completed. In cases where I’m reversing an animation like on hover, then I want.stop(true, false)so the animation can immediately start reversing from where it is without jumping to the end.In practice, this is what I find useful:
Stop everything and clear everything and put the object in the completed state. This is what I use most of the time.
Stop everything, clear the queue of any other animations, but leave the object exactly where it is at the point it was stopped.
Stop the current animation where it is and leave it in a state that you can restart it where it left off.