How would I go about making this animation loop? I have a div that is
controlled by a button. When the button is clicked, the div's css/left
is adjusted to 800. How would I make this div loop? I would need it to
go all the way too 800 and then come back to 0 and start over. Here is
my code:

  <script>
  $(document).ready(function(){
    $("#go").click(function(){
  $(".block:first").animate({ left: 800 }, {
    duration: 6000,
    step: function(now, fx){
      $(".block:gt(0)").css("left", now);
    }
  });
});
$("#stop").click(function(){
  $(".block").stop();
});

  });
  </script>
  <style>div {
   position: relative;
   background-color: #abc;
   width: 40px;
   height: 40px;
   float: left;
   margin: 5px;
}</style>
</head>
<body>
  <button id="go">ยป Run</button><button id="stop">Stop</button>
<div class="block"></div><div class="block"></div><div class="block"></
div><div class="block"></div><div class="block"></div><div
class="block"></div>
</body>

Reply via email to