Start & Stop JQuery Animation
- <!DOCTYPE html>
<html>
<head>
<style>
div {
position: relative;
background-color: #abc;
width: 40px;
height: 40px;
float: left;
margin: 5px;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<p><button id="go">Run »</button></p>
<div class="block"></div> <div class="block"></div>
<div class="block"></div> <div class="block"></div>
<div class="block"></div> <div class="block"></div>
<script>
$( "#go" ).click(function(){
$( ".block:first" ).animate({
top: 100
}, {
duration: 1000,
step: function( now, fx ){
$( ".block:gt(0)" ).css( "top", now );
}
});
});
</script>
</body>
</html>
Need to know how to scroll this forever, and also, need to know how to stop it from scrolling. (Start/Stop).
Missing a loop?
thanks,