jquery content slider sliding
<p>This is the html part of the sliders navigation:</p>

<pre><code>&lt;div id="button"&gt;
     &lt;a class="button1 active" rel="1" href="#"&gt;&lt;/a&gt;
     &lt;a class="button2" rel="2" href="#"&gt;&lt;/a&gt;
     &lt;a class="button3" rel="3" href="#"&gt;&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>This is the complete jQuery code for the slider:</p>

<pre><code>$(document).ready(function (){
  $('#button a').click(function(){
    var integer = $(this).attr('rel');
    /*----- Width of div mystuff (here 160) ------ */
    $('#myslide .cover').animate({left:-160*(parseInt(integer)-1)})
    $('#button a').each(function(){
      $(this).removeClass('active');
      if($(this).hasClass('button'+integer)){
        $(this).addClass('active')
      }
    });
  });   
});
</code></pre>

<p>i am building a content slider for an assignment on college and I am having trouble following this code.</p>

<p>You can find the complete code for this slider <a href="http://www.webdeveloperjuice.com/2010/01/12/lightest-jquery-content-slider-ever-made-380-bytes/" rel="nofollow">here</a>.</p>

<p>Our 3 links have rel attributes with values 1,2 and 3. This line of jQuery calculates how much will the slider slide:</p>

<pre><code>$('#myslide .cover').animate({left:-160*(parseInt(integer)-1)})
</code></pre>

<p>So if the variable integer is 1 it will be <code>-160*(1-1)=0</code> - the slider doesn't move 
if its 2 the result will be -160 and it will move to the right for 160px.
And if its 3 it will move to the right for 320px.</p>

<p>How does this code moves the slide to the left?
It works if you test the demo on the page, but I don't understand how?
Can someone explain it to me please?</p>
