jquery stop() method


  Translation results:

stop

UK[stɒp] US[stɑ:p]

vi. Stop; interrupt; stay; (make) stop working

vt. Stop; block; block; stop payment

n.stop; (organ's) sound stop; stop; (organ's) sound pipe

jquery stop() methodsyntax

Function: The stop() method stops the currently running animation.

Syntax: $(selector).stop(stopAll,goToEnd

Parameters:

##goToEnd Optional. Specifies whether to allow the current animation to be completed. This parameter can only be used when the stopAll parameter is set.

jquery stop() methodexample

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript"> 
$(document).ready(function(){
  $("#start").click(function(){
    $("#box").animate({height:300},2000);
    $("#box").animate({height:100},2000);
  });
  $("#stop").click(function(){
    $("#box").stop();
  });
});
</script>
</head>
 
<body>

<p><button id="start">Start Animation</button><button id="stop">Stop Animation</button></p>

<div id="box" style="background:#98bf21;height:100px;width:100px;position:relative">
</div>
 
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

ParametersDescription
stopAll Optional. Specifies whether to stop all queued animations of the selected elements.