title: how to create loop in carousel with javascript?
body: <p>I wanna to create carousel like <a href="http://www.bootsnipp.com/snippets/featured/media-slider-carousel-bs3" rel="nofollow">http://www.bootsnipp.com/snippets/featured/media-slider-carousel-bs3</a> with java script and I dont know how to create loop?when the last picture is shown how will be shown the first picture ?for example I have 6 product</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>     &lt;div id="slideshow"&gt;
         &lt;div id="ruller"&gt;
            &lt;div class="item"&gt;
              &lt;a href="#"&gt;
              &lt;img src="img/16X10Wallpaper_Persian-Star.org_16.jpg" /&gt;
              &lt;span&gt;product 1&lt;/span&gt;&lt;/a&gt;
            &lt;/div&gt;
  
            &lt;div class="item"&gt;
              &lt;a href="#"&gt;
              &lt;img src="img/16X10Wallpaper_Persian-Star.org_24.jpg" /&gt;
              &lt;span&gt;product 2&lt;/span&gt;&lt;/a&gt;
            &lt;/div&gt;
  
            &lt;div class="item"&gt;
              &lt;a href="#"&gt;
              &lt;img src="img/24ba51c7-d3e2-434a-9e1b-55f1b10d530b_6.jpg" /&gt;
              &lt;span&gt;product 3&lt;/span&gt;&lt;/a&gt;
            &lt;/div&gt; 
         &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p><strong>SCRIPT</strong></p>
  
  <pre><code>    &lt;script&gt;
         a = 0;
  
       left_button.onclick = function () {
         a -= 225;
         ruller.style.left = a + 'px';
       }
  
       reight_button.onclick = function () {
         a += 225;
         ruller.style.left = a + 'px';
       }
      &lt;/script&gt;
  </code></pre>