jQuery stop() Method
You are Here:
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
Value | Type | Explanation |
---|---|---|
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. |
Reminder
Hi Developers, we almost covered 99.5% of jQuery Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in jQuery.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.