Mon Dec 31, 2012 12:12 am
<html>
<head>
<title>Stop animatation in JQuery</title>
<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script>
$(document).ready(function(){
// slides or frames
$("button.animation").click(function(){
var div=$("div.to");
div.animate({left:'+=100px',opacity:'0.8'},5000);
});
// stop animation
$("button.stop").click(function(){
$("div.to").stop();
});
});
</script>
</head>
<body>
<p>Start and stop</p>
<div class="to" style="background:#45F233;height:58px;width:58px;left:120px;position:absolute;">
CM
</div>
<button class="animation">Start Animation</button><br/>
<button class="stop" >Stop</button><br/>
</body>
</html>
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.