Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery Effects – Stopping Animations

jQuery Stop Animation


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

Click here to slide the panel up/down

Time is precious, so we provide you with quick and easy-to-understand learning content.

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


Example

jQuery stop() sliding
Demonstrates 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 complete.

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

Syntax:

$(

selector

).stop(

stopAll,goToEnd

);

The optional stopAll parameter specifies whether the animation queue should be cleared. The default is false, which stops only the active animation and allows any queued animations to proceed afterward.

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

Therefore, by default, stop() clears 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 »