Jquery image carousel make it circular carousel so it is “infinite”
<p>I have this image carousel but I would like to make it circular so that it will infinity scroll how would I modify this code so that it will do this? Also if possible how would I make it auto scroll?</p>

<p>HTML:</p>

<pre><code>&lt;div id="my_carousel"&gt;
&lt;ul&gt;
    &lt;li&gt;some content...&lt;/li&gt;
    &lt;li&gt;some content...&lt;/li&gt;
    &lt;li&gt;some content...&lt;/li&gt;
    &lt;li&gt;some content...&lt;/li&gt;
    &lt;li&gt;some content...&lt;/li&gt;
    &lt;li&gt;some content...&lt;/li&gt;
    .....
&lt;/ul&gt;
</code></pre>

<p></p>

<pre><code>&lt;script language="javascript"&gt;
$(function() {
    var step = 2; 
    var current = 0; 
    var maximum = $('#my_carousel ul li').size(); 
    var visible = 2; 
    var speed = 200; 
    var liSize = 331;
    var carousel_height = 161;


    var ulSize = liSize * maximum;   
    var divSize = liSize * visible;  

    $('#my_carousel ul').css("width", ulSize+"px").css("left", -(current * liSize)).css("position", "absolute");

    $('#my_carousel').css("width", divSize+"px").css("height", carousel_height+"px").css("visibility", "visible").css("overflow", "hidden").css("position", "relative"); 

    $('.btnnext').click(function() { 
        if(current + step &lt; 0 || current + step &gt; maximum - visible) {return; }
        else {
            current = current + step;
            $('#my_carousel ul').animate({left: -(liSize * current)}, speed, null);
        }
        return false;
    });

    $('.btnprev').click(function() { 
        if(current - step &lt; 0 || current - step &gt; maximum - visible) {return; }
        else {
            current = current - step;
            $('#my_carousel ul').animate({left: -(liSize * current)}, speed, null);
        }
        return false;
    });
});
 &lt;/script&gt;
</code></pre>
