title: jquery stop slider at first child and last child
body: <p>I have a jQuery Slider, it slides across quite nicely. However I want the slider to not slide left if it has reached the first child and not to slide right if it has reached the last child </p>
  
  <p>Ive tried adding this on top of the script I have but it doesn't seem to effect anything:</p>
  
  <pre><code>$('.yearslist').find('.li:last-child').stop(true, true);
  </code></pre>
  
  <p>I've created a <a href="http://jsfiddle.net/BMR2Y/" rel="nofollow">jsFiddle</a> or view my JS below:</p>
  
  <p>js/js.js</p>
  
  <pre><code>$(document).ready (Initialize);
  
  function Initialize(){
      InitList();
  }
  
  var moveLeft = false;
  var moveRight = false;
  
  var left = function() {
      if (moveLeft)
  
          $(".yearslist").animate({ "marginLeft": "-=5px" }, 50, 'linear', left);
                      $('.yearslist').find('li:first-child').stop(true, true);
  
  
  };
  
  var right = function() {
      if(moveRight)
  
          $(".yearslist").animate({ "marginLeft": "+=5px" }, 50, 'linear', right);
                                  $('.yearslist').find('.li:last-child').stop(true, true);
  
  
  };
  
  function InitList() {
      $("span#NavigateForward").hover(
          function() { moveLeft=true; left(); },
          function() { moveLeft=false; }
      );
      $("span#NavigateBackward").hover(
          function() { moveRight=true; right(); },
          function() { moveRight=false; }
      );
  }
  </code></pre>