jQuery Stop Animation

The jQuery stop() method is used to stop animations or effects before they are completed.

Effect Demonstration

Click here to slide the panel up/down

An inch of time is an inch of gold, therefore, we provide you with quick and easy-to-understand learning content.

Here, you can obtain any knowledge you need in an easy-to-understand convenient mode.

Example

jQuery stop() Slide
Demonstrate the jQuery stop() method.
jQuery stop() Animation (with parameters)
Demonstrate the jQuery stop() method.

jQuery stop() method

The jQuery stop() method is used to stop animations or effects before they are completed.

The stop() method is applicable to all jQuery effect functions, including sliding, fading, and custom animations.

Syntax

$(selector).stop(stopAll,goToEnd);

Optional stopAll The parameter specifies whether the animation queue should be cleared. The default is false, meaning only the active animation is stopped, allowing any queued animations to proceed.

Optional goToEnd The parameter specifies whether the current animation should be completed immediately. The default is false.

Therefore, by default, stop() will clear the current animation specified on the selected element.

The following example demonstrates the stop() method without parameters:

Example

$("#stop").click(function(){
  $("#panel").stop();
);

Try It Yourself

jQuery Effects Reference Manual

For a comprehensive review of jQuery effects, please visit our jQuery Effects Reference Manual.