title: Prevent infinite loop in jQuery
body: <p>Should be quite a simple one. I want this jQuery animation to stop running after 1 loop, rather than an infinite loop.</p>
  
  <p>It's most definitely something simple, but this is code I had help with a while back and I can't for the life of me figure out why it is looping.</p>
  
  <p>Thanks.</p>
  
  <p>jsFiddle:
  <a href="http://jsfiddle.net/SFejj/" rel="nofollow">http://jsfiddle.net/SFejj/</a> and the code:</p>
  
  <pre><code>function move(jElem, bUp, iSpeed) {
      jElem.animate(
          {
           opacity: (bUp ? '+' : '-') + '0.1',
           width: (bUp ? '+' : '-') + '=200',
           height: (bUp ? '+' : '-') + '=200'},
          iSpeed,
          function() {
              move(jElem, !bUp, iSpeed);
          }
      );
  }
  
  $(document).ready(function() {
      $('.navImage').each(function(iIndex, jElem) {
          // get random delay
          var iTime = Math.floor(Math.random() * 1000);
          // get random speed
          var iSpeed = Math.floor(Math.random() * 1000) + 1500;
          setTimeout(
              function() {
                  move($(jElem), true, iSpeed);
              }, 
              iTime
          );
      });
  });
  </code></pre>