title: how to stop an animation loop
body: <p>The code below basicly animates a div back and forth. Then I want the animation to stop while hovering. It works if I remove this line: "$(".block").animate({left: '0px'}, 1, animate);" but then the div just animates once wich is not what I want. So how do keep the .stop() functionality but still get the animation to loop in infinity ?</p>
  
  <pre><code>$(function animate(){
  $(".block").animate({left: '+=500px'}, 2000);
  $(".block").animate({left: '0px'}, 1, animate);
  });
  
  $(".block").hover(function(){
  $(".block").stop();
  $(".block").animate({ width:"20%", height:"20%"}, 500 );
  });
  </code></pre>