Go back to first slide when done scrolling
<p>Hi I am hiving trouble about sliding content using this plugin
<a href="http://www.copterlabs.com/demo/contentslider/" rel="nofollow">http://www.copterlabs.com/demo/contentslider/</a> I already figured it out on how auto slide it till the end but it is not going back to first slide when it reach the last one.
Please see my code.</p>

<p>jquery.ennui.contentslider.js</p>

<pre><code>    (function($) {
  $.fn.ContentSlider = function(options)
  {
    var defaults = {
      leftBtn : 'images/cs_leftImg.jpg',
      rightBtn : 'images/cs_rightImg.jpg',
      width : '900px',
      height : '400px',
      speed : 400,
      easing : 'easeOutQuad',
      textResize : false,
      IE_h2 : '26px',
      IE_p : '11px'
    }
    var defaultWidth = defaults.width;
    var o = $.extend(defaults, options);
    var w = parseInt(o.width);
    var n = this.children('.cs_wrapper').children('.cs_slider').children('.cs_article').length;
    var x = -1*w*n+w; // Minimum left value
    var p = parseInt(o.width)/parseInt(defaultWidth);
    var thisInstance = this.attr('id');
    var inuse = false; // Prevents colliding animations

    function moveSlider(d, b)
    {
      var l = parseInt(b.siblings('.cs_wrapper').children('.cs_slider').css('left'));
      if(isNaN(l)) {
        var l = 0;
      }
      var m = (d=='left') ? l-w : l+w;
      if(m&lt;=0&amp;&amp;m&gt;=x) {
        b
          .siblings('.cs_wrapper')
            .children('.cs_slider')
              .animate({ 'left':m+'px' }, o.speed, o.easing, function() {
                inuse=false;
              });

        if(b.attr('class')=='cs_leftBtn') {
          var thisBtn = $('#'+thisInstance+' .cs_leftBtn');
          var otherBtn = $('#'+thisInstance+' .cs_rightBtn');
        } else {
          var thisBtn = $('#'+thisInstance+' .cs_rightBtn');
          var otherBtn = $('#'+thisInstance+' .cs_leftBtn');
        }
        if(m==0||m==x) {
          thisBtn.animate({ 'opacity':'0' }, o.speed, o.easing, function() { thisBtn.hide(); });
        }
        if(otherBtn.css('opacity')=='0') {
          otherBtn.show().animate({ 'opacity':'1' }, { duration:o.speed, easing:o.easing });
        }
      }
    }

    function vCenterBtns(b)
    {
      // Safari and IE don't seem to like the CSS used to vertically center
      // the buttons, so we'll force it with this function
      var mid = parseInt(o.height)/2;
      b
        .find('.cs_leftBtn img').css({ 'top':mid+'px', 'padding':0 }).end()
        .find('.cs_rightBtn img').css({ 'top':mid+'px', 'padding':0 });
    }

    return this.each(function() {
      $(this)
        // Set the width and height of the div to the defined size
        .css({
          width:o.width,
          height:o.height
        })
        // Add the buttons to move left and right
        .prepend('&lt;a href="#" class="cs_leftBtn"&gt;&lt;img src="'+o.leftBtn+'" /&gt;&lt;/a&gt;')
        .append('&lt;a href="#" class="cs_rightBtn"&gt;&lt;img src="'+o.rightBtn+'" /&gt;&lt;/a&gt;')
        // Dig down to the article div elements
        .find('.cs_article')
          // Set the width and height of the div to the defined size
          .css({
            width:o.width,
            height:o.height
          })
          .end()
        // Animate the entrance of the buttons
        .find('.cs_leftBtn')
          .css('opacity','0')
          .hide()
          .end()
        .find('.cs_rightBtn')
          .hide()
          .animate({ 'width':'show' });

      // Resize the font to match the bounding box
      if(o.textResize===true) {
        var h2FontSize = $(this).find('h2').css('font-size');
        var pFontSize = $(this).find('p').css('font-size');
        $.each(jQuery.browser, function(i) {
          if($.browser.msie) {
             h2FontSize = o.IE_h2;
             pFontSize = o.IE_p;
          }
        });
        $(this).find('h2').css({ 'font-size' : parseFloat(h2FontSize)*p+'px', 'margin-left' : '66%' });
        $(this).find('p').css({ 'font-size' : parseFloat(pFontSize)*p+'px', 'margin-left' : '66%' });
        $(this).find('.readmore').css({ 'font-size' : parseFloat(pFontSize)*p+'px', 'margin-left' : '66%' });
      }

      // Store a copy of the button in a variable to pass to moveSlider()
      var leftBtn = $(this).children('.cs_leftBtn');
      leftBtn.bind('click', function() {
        if(inuse===false) {
          inuse = true;
          moveSlider('right', leftBtn);
        }
        return false; // Keep the link from firing
      });

      // Store a copy of the button in a variable to pass to moveSlider()
      var rightBtn = $(this).children('.cs_rightBtn');
      rightBtn.bind('click', function() {
        if(inuse===false) {
          inuse=true;
          moveSlider('left', rightBtn);
        }
        return false; // Keep the link from firing
      });

      vCenterBtns($(this)); // This is a CSS fix function.
    });
  }
})(jQuery)
</code></pre>

<p>jscript.js</p>

<pre><code>$(document).ready(function(){

    setInterval(function(){
    $('.cs_rightBtn').click()
    },3000)
});
</code></pre>

<p>html</p>

<pre><code>&lt;!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
</code></pre>

<p></p>

<p>
    
    
    </p>

<pre><code>&lt;title&gt; Content Slider Demonstration | Ennui Design &lt;/title&gt;
</code></pre>

<p></p>

<pre><code>&lt;body&gt;

    &lt;h1&gt; Content Slider Demonstration &lt;/h1&gt;
    &lt;h2&gt; Content Slider Version 1 &lt;/h2&gt;
    &lt;p&gt;
        This content slider was implemented with the following code:
    &lt;/p&gt;
</code></pre>

<pre>$(function() {
    $('#one').ContentSlider({
        width : '900px',
        height : '400px',
        speed : 800,
        easing : 'easeInOutBack'
    });
});</pre>

<pre><code>    &lt;div id="one" class="contentslider"&gt;
        &lt;div class="cs_wrapper"&gt;
            &lt;div class="cs_slider"&gt;

                &lt;div class="cs_article"&gt;
                    &lt;h2&gt; &lt;a href="#"&gt;Article Number One&lt;/a&gt; &lt;/h2&gt;
                    &lt;a href="#"&gt;
                        &lt;img src="images/article01.jpg"
                            alt="Artist's interpretation of article headline" /&gt;
                    &lt;/a&gt;
                    &lt;p&gt;
                        Hendrerit tincidunt vero vel eorum claritatem. Soluta
                        legunt quod qui dolore typi. Vel dolore soluta qui odio
                        non. Sollemnes minim eorum feugiat nihil nobis. Gothica
                        dolor in legentis nihil quinta.
                    &lt;/p&gt;
                    &lt;p&gt;
                        Iriure parum autem putamus lectores duis. Quam sit quis
                        me me zzril. Facer etiam in lectores hendrerit etiam.
                        Exerci lorem liber tincidunt nostrud decima. Mutationem
                        est zzril ipsum facer nobis.
                    &lt;/p&gt;
                    &lt;a href="#" class="readmore"&gt;Read More&lt;/a&gt;
                &lt;/div&gt;&lt;!-- End cs_article --&gt;

                &lt;div class="cs_article"&gt;
                    &lt;h2&gt; &lt;a href="#"&gt;Article Number Two&lt;/a&gt; &lt;/h2&gt;
                    &lt;a href="#"&gt;
                        &lt;img src="images/article02.jpg"
                            alt="Artist's interpretation of article headline" /&gt;
                    &lt;/a&gt;
                    &lt;p&gt;
                        Nibh nihil et ex accumsan insitam. Qui lius congue
                        hendrerit quam vero. Demonstraverunt molestie ipsum
                        magna nobis sequitur. Ex diam euismod quis ii velit.
                    &lt;/p&gt;
                    &lt;p&gt;
                        In quam lectores placerat Investigationes illum. Diam
                        sollemnes nihil lorem claram consectetuer. Eros nam
                        placerat claritas claritatem congue. Adipiscing ut
                        clari suscipit nulla habent.
                    &lt;/p&gt;
                    &lt;a href="#" class="readmore"&gt;Read More&lt;/a&gt;
                &lt;/div&gt;&lt;!-- End cs_article --&gt;

                &lt;div class="cs_article"&gt;
                    &lt;h2&gt; &lt;a href="#"&gt;Article Number Three&lt;/a&gt; &lt;/h2&gt;
                    &lt;a href="#"&gt;
                        &lt;img src="images/article03.jpg"
                            alt="Artist's interpretation of article headline" /&gt;
                    &lt;/a&gt;
                    &lt;p&gt;
                        Clari eum vel blandit notare quarta. Autem processus
                        lectores augue iriure facit. Volutpat aliquip erat
                        imperdiet ipsum tation. Typi luptatum ut
                        demonstraverunt eros quam. Ut clari consectetuer
                        tincidunt liber qui. 
                    &lt;/p&gt;
                    &lt;p&gt;
                        Modo vel facilisis qui liber est. Eorum Investigationes
                        processus adipiscing commodo ea. Id iis claritatem vero
                        ea consequat.
                    &lt;/p&gt;
                    &lt;a href="#" class="readmore"&gt;Read More&lt;/a&gt;
                &lt;/div&gt;&lt;!-- End cs_article --&gt;

                &lt;div class="cs_article"&gt;
                    &lt;h2&gt; &lt;a href="#"&gt;Article Number Four&lt;/a&gt; &lt;/h2&gt;
                    &lt;a href="#"&gt;
                        &lt;img src="images/article04.jpg"
                            alt="Artist's interpretation of article headline" /&gt;
                    &lt;/a&gt;
                    &lt;p&gt;
                        Iis nostrud claritas quis sed qui. Ut nunc facilisi
                        claritatem quinta sit. Assum ii liber diam zzril nobis.
                        Qui nibh delenit fiant te illum. Delenit claritas ut
                        exerci eros typi. 
                    &lt;/p&gt;
                    &lt;p&gt;
                        Videntur vel euismod ut eleifend quis. Nobis aliquam
                        nunc vero blandit illum. Lius placerat litterarum
                        processus quam legere. Accumsan modo non at congue
                        duis. Odio duis ut blandit feugait in. 
                    &lt;/p&gt;
                    &lt;a href="#" class="readmore"&gt;Read More&lt;/a&gt;
                &lt;/div&gt;&lt;!-- End cs_article --&gt;

            &lt;/div&gt;&lt;!-- End cs_slider --&gt;
        &lt;/div&gt;&lt;!-- End cs_wrapper --&gt;
    &lt;/div&gt;&lt;!-- End contentslider --&gt;

    &lt;h2&gt; Content Slider Version 2 &lt;/h2&gt;
    &lt;p&gt;
        This content slider was implemented with the following code:
    &lt;/p&gt;
</code></pre>

<pre>$(function() {
    $('#two').ContentSlider({
        width : '600px',
        height : '266px',
        speed : 400,
        easing : 'easeOutQuad',
        textResize : true
    });
});</pre>

<pre><code>    &lt;div id="two" class="contentslider"&gt;
        &lt;div class="cs_wrapper"&gt;
            &lt;div class="cs_slider"&gt;

                &lt;div class="cs_article"&gt;
                    &lt;h2&gt; &lt;a href="#"&gt;Article Number One&lt;/a&gt; &lt;/h2&gt;
                    &lt;a href="#"&gt;
                        &lt;img src="images/article01.jpg"
                            alt="Artist's interpretation of article headline" /&gt;
                    &lt;/a&gt;
                    &lt;p&gt;
                        Hendrerit tincidunt vero vel eorum claritatem. Soluta
                        legunt quod qui dolore typi. Vel dolore soluta qui odio
                        non. Sollemnes minim eorum feugiat nihil nobis. Gothica
                        dolor in legentis nihil quinta.
                    &lt;/p&gt;
                    &lt;p&gt;
                        Iriure parum autem putamus lectores duis. Quam sit quis
                        me me zzril. Facer etiam in lectores hendrerit etiam.
                        Exerci lorem liber tincidunt nostrud decima. Mutationem
                        est zzril ipsum facer nobis.
                    &lt;/p&gt;
                    &lt;a href="#" class="readmore"&gt;Read More&lt;/a&gt;
                &lt;/div&gt;&lt;!-- End cs_article --&gt;

                &lt;div class="cs_article"&gt;
                    &lt;h2&gt; &lt;a href="#"&gt;Article Number Two&lt;/a&gt; &lt;/h2&gt;
                    &lt;a href="#"&gt;
                        &lt;img src="images/article02.jpg"
                            alt="Artist's interpretation of article headline" /&gt;
                    &lt;/a&gt;
                    &lt;p&gt;
                        Nibh nihil et ex accumsan insitam. Qui lius congue
                        hendrerit quam vero. Demonstraverunt molestie ipsum
                        magna nobis sequitur. Ex diam euismod quis ii velit.
                    &lt;/p&gt;
                    &lt;p&gt;
                        In quam lectores placerat Investigationes illum. Diam
                        sollemnes nihil lorem claram consectetuer. Eros nam
                        placerat claritas claritatem congue. Adipiscing ut
                        clari suscipit nulla habent.
                    &lt;/p&gt;
                    &lt;a href="#" class="readmore"&gt;Read More&lt;/a&gt;
                &lt;/div&gt;&lt;!-- End cs_article --&gt;

                &lt;div class="cs_article"&gt;
                    &lt;h2&gt; &lt;a href="#"&gt;Article Number Three&lt;/a&gt; &lt;/h2&gt;
                    &lt;a href="#"&gt;
                        &lt;img src="images/article03.jpg"
                            alt="Artist's interpretation of article headline" /&gt;
                    &lt;/a&gt;
                    &lt;p&gt;
                        Clari eum vel blandit notare quarta. Autem processus
                        lectores augue iriure facit. Volutpat aliquip erat
                        imperdiet ipsum tation. Typi luptatum ut
                        demonstraverunt eros quam. Ut clari consectetuer
                        tincidunt liber qui. 
                    &lt;/p&gt;
                    &lt;p&gt;
                        Modo vel facilisis qui liber est. Eorum Investigationes
                        processus adipiscing commodo ea. Id iis claritatem vero
                        ea consequat.
                    &lt;/p&gt;
                    &lt;a href="#" class="readmore"&gt;Read More&lt;/a&gt;
                &lt;/div&gt;&lt;!-- End cs_article --&gt;

                &lt;div class="cs_article"&gt;
                    &lt;h2&gt; &lt;a href="#"&gt;Article Number Four&lt;/a&gt; &lt;/h2&gt;
                    &lt;a href="#"&gt;
                        &lt;img src="images/article04.jpg"
                            alt="Artist's interpretation of article headline" /&gt;
                    &lt;/a&gt;
                    &lt;p&gt;
                        Iis nostrud claritas quis sed qui. Ut nunc facilisi
                        claritatem quinta sit. Assum ii liber diam zzril nobis.
                        Qui nibh delenit fiant te illum. Delenit claritas ut
                        exerci eros typi. 
                    &lt;/p&gt;
                    &lt;p&gt;
                        Videntur vel euismod ut eleifend quis. Nobis aliquam
                        nunc vero blandit illum. Lius placerat litterarum
                        processus quam legere. Accumsan modo non at congue
                        duis. Odio duis ut blandit feugait in. 
                    &lt;/p&gt;
                    &lt;a href="#" class="readmore"&gt;Read More&lt;/a&gt;
                &lt;/div&gt;&lt;!-- End cs_article --&gt;

            &lt;/div&gt;&lt;!-- End cs_slider --&gt;
        &lt;/div&gt;&lt;!-- End cs_wrapper --&gt;
    &lt;/div&gt;&lt;!-- End contentslider --&gt;

    &lt;p class="footer"&gt;
        All Content &amp;copy; 2009 Ennui Design | &lt;a href="http://validator.w3.org/check?uri=referer"&gt;Valid XHTML 1.0 Strict&lt;/a&gt;
    &lt;/p&gt;
    &lt;!-- Site JavaScript --&gt;
    &lt;script type="text/javascript"
        src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="js/jscript.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="js/jquery.easing.1.3.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="js/jquery.ennui.contentslider.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
        $(function() {
            $('#one').ContentSlider({
                width : '900px',
                height : '400px',
                speed : 800,
                easing : 'easeInOutBack'
            });
        });
        $(function() {
            $('#two').ContentSlider({
                width : '600px',
                height : '266px',
                speed : 400,
                easing : 'easeOutQuad',
                textResize : true
            });
        });
    &lt;/script&gt;
    &lt;script src="js/jquery.chili-2.2.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script src="js/chili/recipes.js" type="text/javascript"&gt;&lt;/script&gt;

&lt;/body&gt;
</code></pre>

<p></p>

<p>I can't even click the previous button when it reach the last slide.</p>
