title: How can we increase slides limit to dynamic currently it set for only 3 slide
body: <p>I want to create same fadeIn and fadeOut effect which is shown in given below example:</p>
  
  <p><a href="http://www.spicypeanut.net/Slideshow/Slideshow.html" rel="nofollow">http://www.spicypeanut.net/Slideshow/Slideshow.html</a></p>
  
  <p><a href="http://www.spicypeanut.net/Blog/jQuery%20Slideshow.html" rel="nofollow">http://www.spicypeanut.net/Blog/jQuery%20Slideshow.html</a></p>
  
  <p>But the issue is - this example was created only for 3 slides and i want more then 3 slides or need this to be dynamically increased.</p>
  
  <p>but how do i modify the script that it gets the maximum amount of slides automatic? If i generate the slide dynamic within a cms for example no one can say what the maximum number of slides will be.. so i have to update the *.js everytime by hand at this parts :/ </p>
  
  <pre><code>if (this.Last &lt; 1) { 
  this.Last = 3;
  } 
  
  if ($$.Slideshow.Counter &gt; 3) 
  { 
  $$.Slideshow.Counter = 1; # 
  } 
  </code></pre>
  
  <p>Would be nice if you could help me (and i think many others) at this point :)</p>
  
  <p><strong>Below is the JS used in this example:</strong></p>
  
  <pre><code>var $$ = $.fn;
  
  $$.extend({
    SplitID : function()
    {
      return this.attr('id').split('-').pop();
    },
  
    Slideshow : {
      Ready : function()
      {
        $('div.tmpSlideshowControl')
          .hover(
            function() {
              $(this).addClass('tmpSlideshowControlOn');
            },
            function() {
              $(this).removeClass('tmpSlideshowControlOn');
            }
          )
          .click(
            function() {
              $('div.tmpSlide').hide();
              $('div.tmpSlideshowControl').removeClass('tmpSlideshowControlActive');
  
              $('div#tmpSlide-' + $(this).SplitID()).show()
              $(this).addClass('tmpSlideshowControlActive');
            }
          );
  
        this.Counter = 1;
  
        this.Transition();
      },
  
      Transition : function()
      {
        if (this.Interrupted) {
          return;
        }
  
        this.Last = this.Counter - 1;
  
        if (this.Last &lt; 1) {
          this.Last = 3;
        }
  
        $('div#tmpSlide-' + this.Last).fadeOut(
          'slow',
          function() {
            $('div#tmpSlideshowControl-' + $$.Slideshow.Last).removeClass('tmpSlideshowControlActive');
            $('div#tmpSlideshowControl-' + $$.Slideshow.Counter).addClass('tmpSlideshowControlActive');
            $('div#tmpSlide-' + $$.Slideshow.Counter).fadeIn('slow');
  
            $$.Slideshow.Counter++;
  
            if ($$.Slideshow.Counter &gt; 3) {
              $$.Slideshow.Counter = 1;
            }
  
            setTimeout('$$.Slideshow.Transition();', 5000);
          }
        );
      }
    }
  });
  
  $(document).ready(
    function() {
      $$.Slideshow.Ready();
    }
  );
  </code></pre>
  
  <p>Even i have also done some R&amp;D and found one more amazing issue :</p>
  
  <p>When i increased its Last vale 3 to 5 then its showing problem in navigation controls - Like if your slide is on 4 then if you clicked on 2 then your navigation will be moving on previous track mean it will move to 5 instead of 3.</p>
  
  <p>So please if someone can help me out in this.</p>