Slideshow - continuous loop
<p>any help with this would be greatfully appreciated!</p>

<p>I'm trying to implement the script from:</p>

<p><a href="http://www.switchonthecode.com/tutorials/jquery-creating-a-slideshow" rel="nofollow">www.switchonthecode.com/tutorials/jquery-creating-a-slideshow</a></p>

<p>but I would like it to loop continuously, I've managed to get it to loop back and forth:</p>

<pre><code> var totalSlides = 0;
 var currentSlide = 1;
 var contentSlides = "";

 $(document).ready(function(){
   $("#slideshow-previous").click(showPreviousSlide);
   $("#slideshow-next").click(showNextSlide);

   var totalWidth = 0;
   contentSlides = $(".slideshow-content");
   contentSlides.each(function(i){
     totalWidth += this.clientWidth;
     totalSlides++;
   });
   $("#slideshow-holder").width(totalWidth);
   $("#slideshow-scroller").attr({scrollLeft: 0});
   updateButtons();
 });

function showPreviousSlide()
{
  currentSlide--;
  if (currentSlide &lt; 1) currentSlide = totalSlides;
  updateContentHolder();
  updateButtons();
 }

 function showNextSlide()
 {
   currentSlide++;
   if (currentSlide &gt; totalSlides) currentSlide = 1;
   updateContentHolder();
   updateButtons();
 }

 function updateContentHolder()
 {
   var scrollAmount = 0;
   contentSlides.each(function(i){
     if(currentSlide - 1 &gt; i) {
       scrollAmount += this.clientWidth;
     }
  });
  $("#slideshow-scroller").animate({scrollLeft: scrollAmount}, 1000);
 }

 function updateButtons()
 {
 if(currentSlide &lt; totalSlides) {
   $("#slideshow-next").show();}

 if(currentSlide &gt; 1) {
   $("#slideshow-previous").show();}
 }
</code></pre>

<p>I've been looking at this for 2 nights now and can't work it out. </p>

<p>Can anyone please help? </p>

<p>Thanks in advance.</p>
