<!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);
});
$("#btnstop").click(function(){
$("div").stop();
});
$("#btnback").click(function(){
$("div").animate({
marginLeft: '0px',
}, 3000);
});
});
</script>
<style type="text/css">
#animatebox {
width: 100px;
height: 100px;
position: absolute;
background: #FC5E5E;
border-color: #de2d2d;
}
</style>
</head>
<body>
<button id="btnstart">Start</button>
<button id="btnstop">Stop</button>
<button id="btnback">Back</button>
<br /><br />
<div id="animatebox"></div>
</body>
</html>