title: If statement in setInterval only working once
body: <p>I'm new to Stack Overflow, so excuse me if I'm completely doing something I shouldn't be doing, and let me know so I can learn.</p>
  
  <p>Anyway! The code:</p>
  
  <pre><code>$(document).ready(function() {    
      var imgWidth = $(".window").width();
      var imgSize = $(".image_reel img").size();
      var imgReelWidth = imgWidth * imgSize;
  
  
      $(".image_reel").css({
          width: imgReelWidth});
  
      var num = 960;
      var numImgs = $('div.image_reel img').length;
      var currentSlide = 0;
  
      setInterval(function() {    
          currentSlide++;
  
          if (currentSlide != numImgs) {
              $(".image_reel").animate({
                  left: -num
              }, 1000);
          }
          else {
              var setWidth = numImgs - 1;
              var newSlideNum = num * setWidth;
              $(".image_reel").animate({
                  left: newSlideNum
              }, 1000);
              currentSlide = 0;    
          }
      }, 2000);
  });
  </code></pre>
  
  <p>What this code is supposed to be doing (or at least I thought it was...) is that after 2 seconds, it will loop through the if statement and check if the "current slide" is equal to the amount of images there are. Now I checked with the alert function to see if all the numbers are correct and they are, but for some reason, the slider is only working once, and that's it. Any ideas why?</p>
  
  <p>Thanks in advance guys.</p>