title: How can I call clearInterval outside of a function in jQuery? Outside the setInterval
body: <pre><code>    function iPadMovie(id) {
      $(function () {
          var i = 1;
          var interval = setInterval(function () {
              jQuery('.animationMax img').attr({
                  src: 'http://jdsports.scene7.com/is/image/JDSports/127932jd' + ('0' + i).slice(-2) + '?hei=255&amp;amp;wid=427&amp;amp;resmode=sharp&amp;amp;op_usm=1.1,0.5,0,0&amp;amp;defaultImage=JDSports/sizeImageMissing'
              });
              i++;
              if (i === 28) i = 1;
          }, 100);
      });
  }
  
  function playIpad(){
      iPadMovie();
  }
  
  
  function stopIpad(){
      clearInterval = interval;
  }
  </code></pre>
  
  <p>You can see the fiddle here: <a href="http://jsfiddle.net/Vv2u3/15/" rel="nofollow">http://jsfiddle.net/Vv2u3/15/</a> I want to be able to stop the movie and restart it if they press play. Surely I can use clearInterval outside the method?</p>