jQuery stop animation With Example

We can use jQuery stop() function to stop the currently running animation on the matched elements.

jQuery stop()

There are two variants of jQuery stop() function.

  1. stop(boolean clearQueue, boolean jumpToEnd): Default value of both the argument is false. We can pass clearQueue as true to stop the queued animation. We can pass jumpToEnd as true to complete the current animation immediately.
  2. stop(String queue, boolean clearQueue, boolean jumpToEnd): Here we can pass the name of the queue to stop the animation, other two arguments are same as above.

jQuery stop animation

Here is a simple example for jQuery stop animation.

Notice that I am not passing any parameter with stop() function call, it’s because there is only one animation and I want it to stop as soon as stop button is clicked.

jQuery stop animation queue

Here is an example where animation queue is cleared and current running animation is also stopped when stop button is clicked.

Below image shows the above program in action.

jquery stop animation

That’s all for jQuery stop() function and jQuery stop animation example.

Reference: API Doc

By admin

Leave a Reply

%d bloggers like this: