Syntax for stop() method in jQuery
$(selector).stop(stopall,gotoend);
Example
$("#seltr").stop();
Example for stop()
<script type="text/javascript">
function anistart()
{
$("#adiv").animate({'margin-left':"+=10"},100);
}
function anistop()
{
$("#adiv").stop();
}
</script>
<div id="adiv" style="width:50px;height:50px;background:red;"></div>
<input type="button" onclick="anistart();" value="Start Animation">
<input type="button" onclick="anistop();" value="Stop Animation">
Output:
Simple Example to stop() method used in slideToggle method
<script type="text/javascript">
function tglstp()
{
$("#testdiv").stop().slideToggle();
}
</script>
<input onclick="tglstp();" type="button" value="Slide Toggle with Stop">
<div id="testdiv" style="width:100px;height:80px;background:red;"></div>
Output:
Example Program:- (Editor)
Editor is Loading...
Advertisement
0 comments:
Post a Comment