jQuery Stop()


The jQuery stop() function is used to halt animations or effects before they're completed.


jQuery stop() Method

The jQuery stop() function is used to halt an animation or effect before it completes.

The stop() function can be used with various jQuery animation effects, like sliding, fading, and custom animations.

Syntax:

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

The "stopAll" option lets you decide whether to clear the animation queue or not. By default, it's set to "false," meaning only the current animation stops. This way, any animations waiting in line can still run afterward.

You can use the "goToEnd" option to decide if you want to finish the ongoing animation right away or not. By default, it's set to "false."

In the usual case, when you use the stop() method, it immediately stops the animation that's currently happening on the chosen item.

In this example, we'll show you how to use the stop() method without any additional settings: