jquery custom slider - auto animate slides
<p>I have created a jquery slider. On clicking next or back buttons .animate function is used to show next list item. Both next and previous buttons are working but now i want slides to animate automatically after every x time. I could not figure out how jquery timeout function works. </p>

<pre><code>current = 0;
current_slide=1;
$(document).ready(function(){
    width=951;
    var totalSlides=$(".slider ul li").length;
    $(".slider ul").removeAttr('width');
    $(".slider ul").attr('width',width*totalSlides);

    $('#next img').click(function(){
        current_slide++;
        current -= width;
        if(current_slide&gt;totalSlides)
            {
                current=0;
                current_slide=1;
                //$(".slider ul").css('left',(totalSlides)*width);  
                $(".slider ul").animate({"left":current+"px"}, "fast");
            }
        else
            $(".slider ul").animate({"left":current+"px"}, "slow");
    });

    $('#prev img').click(function(){
        current_slide--;
        current += width;
        if (current_slide &lt; 1) 
            {
                current = (totalSlides-1)*(-width);
                current_slide = totalSlides;
                $(".slider ul").animate({"left":current+"px"}, "fast");
            }
        else
            $(".slider ul").animate({"left":current+"px"}, "slow"); 
    });
});
</code></pre>
