The JQuery Stop () method is used to stop animations or effects before they are finished.
JQuery Stop () method
The JQuery Stop () method is used to stop animations or effects before they are finished.
The Stop () method applies to all JQuery effect functions, including sliding, fading, and custom animations.
Grammar
$ (selector). Stop (Stopall,gotoend);
The optional StopAll parameter specifies whether the animation queue should be cleared. The default is false, which stops only active animations, allowing any queued animation to be executed backwards.
The optional gotoend parameter specifies whether to complete the current animation immediately. The default is False.
Therefore, by default, stop () clears the current animation specified on the selected element.
The following example shows the Stop () method with no parameters:
Instance
1<! DOCTYPE html>234<script src= "/jquery/jquery-1.11.1.min.js" ></script>5<script>6$ (document). Ready (function(){7$ ("#flip"). Click (function(){8$ ("#panel"). Slidedown (5000);9 });Ten$ ("#stop"). Click (function(){ One$ ("#panel").stop (); A }); - }); -</script> the -<style type= "Text/css" > - #Panel, #flip - { +Padding5px; -Text-align:Center; +Background-color:#E5EECC; ABorder:solid 1px#c3c3c3; at } - #Panel - { -Padding50px; -Displaynone; - } in</style> - to +<body> - the<button id= "Stop" > Stop sliding </button> *<div id= "Flip" > Click here to slide the panel down </div> $<div id= "Panel" >hello world!</div>Panax Notoginseng -</body> theView CodeView results:Default effect:
Click to swipe, and then point to stop:
Click on the slide again:
JQuery Stop Animation