<!DOCTYPE html>
<html>
<head>
<title>jQuery stop() method</title>
<script src="jquery-latest.min.js"></script>
<script>
$(document).ready(function() {
$("#btnstart").click(function(){
$("div").animate({marginLeft: '+=200px'}, 3000);
$("div").animate({fontSize: '25px'}, 3000);
});
$("#btnstop").click(function(){
$("div").stop();
});
$("#btnstopall").click(function(){
$("div").stop(true);
});
$("#btnstopandfinish").click(function(){
$("div").stop(true, true);
});
$("#btnback").click(function(){
$("div").animate({marginLeft: '0px'}, 3000);
$("div").animate({fontSize: '12px'}, 3000);
});
});
</script>
<style type="text/css">
#animatebox {
width: 100px;
height: 100px;
position: absolute;
background: #FC5E5E;
border-color: #de2d2d;
font-size: 12px;
}
</style>
</head>
<body>
<button id="btnstart">Start</button>
<button id="btnstop">Stop</button>
<button id="btnstopall">Stop All</button>
<button id="btnstopandfinish">Stop and Finish</button>
<button id="btnback">Back</button>
<br /><br />
<div id="animatebox">Stop</div>
</body>
</html>