jQuery looping command
<p>How can I make this animation repeat continuously from the beginning?
<a href="http://jsfiddle.net/philoman/RuX5d/8/" rel="nofollow">http://jsfiddle.net/philoman/RuX5d/8/</a></p>

<pre><code>$(document).ready(function() {
var i = 1, dir = 1, curFx = 'fadeIn';
var interval = setInterval(function () {
    if (i == 2 &amp;&amp; $('#slide1').is(':visible')) {
        $('#slide1').fadeOut(6000);             
        return;
    }

    $('#slide'+ i)[curFx](1500);

    i = i + 1*dir;

    if (i == 10 || i == -1) {
        dir = (dir == 1)?-1:1;
        curFx = (curFx == 'fadeIn')?'fadeOut':'fadeIn';
    }        
}, 1500);
});
</code></pre>
