jQuery stop() Method

Last Updated:

jQuery stop() Method

The jQuery stop() method stops the currently running animation for the selected elements.

Example

HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <style> div{ width: 100px; height: 100px; background: #f69d3c; margin-bottom: 10px; line-height: 6; text-align: center; } </style> </head> <body> <h1>jQuery stop() Method</h1> <div>Div</div> <button id="myAnimate">Animate</button> <button id="myStop">Stop</button> <script> $(document).ready(function(){ $("#myAnimate").click(function(){ $("div").animate({width: 200}, 2000); }); $("#myStop").click(function(){ $("div").stop(); }); }); </script> </body> </html>

Syntax

$(selector).stop(clearQueue, jumpToEnd);

Parameter Values

ValueTypeExplanation
clearQueue Optional A Boolean indicating whether to remove queued animation as well.
By default, clearQueue is false.
jumpToEnd Optional A Boolean indicating whether to complete the current animation immediately.
By default, jumpToEnd is false.

Browser Support

Devicedesktopmobile
Browsergoogle chromesafarifirefoxinternet Exploreredgeoperagoogle chromesafarifirefoxedgeoperaandroid webviewsamsung internet
stop()YesYesYesYesYesYesYesYesYesYesYesYesYes

Share this Page

Meet the Author