.stop()The .stop() method in jQuery is used to stop the currently-running animation.
.stop() syntax.stop([clearQueue][,jumpToEnd]);
| Parameter | Type | Description |
|---|---|---|
clearQueue |
Boolean | whether clear the queue.Default false |
jumpToEnd |
Boolean | whether to complete the current animation immediately.Default false |
queue |
Function | The name of the queue. |
.stop() Examplesstop the currently-running animation.
$("#clickme").click(function(){
$('#box').stop();
});
click the STOP button to stop animation where it's currently positioned
HTML
<button id="go">Go</button> <button id="stop">STOP!</button> <div id="block"></div>
// Start animation
$("#go").click(function(){
$("#block").animate({left: '+=200px'}, 2000);
});
// Stop animation
$("#stop").click(function(){
$("#block").stop();
});
