jQuery image rotator
<p>I was wondering if someone could help with i jQuery plugin. Basically what I want to do is to fade out each image in a div and when it comes to the last visible image it should go backwards fading in.</p>

<p>This is what I've done so far:</p>

<pre><code>setTimeout((function rotate(back) {
    if ($('img:visible', $container).length &gt; 1) {
        $('img:visible:last', $container).fadeOut(opts.animation, function () {
            setTimeout(rotate, opts.interval);
        });
    } else {
        $('img:hidden:first', $container).fadeIn(opts.animation, function () {
            setTimeout(rotate, opts.interval);
        });
    }
}), opts.interval);
</code></pre>

<p>But pretty obviously you can see that this does not work. It starts ok and then goes back 1 image and then forward again.</p>

<p>Hope someone can give me a hand on this :)</p>
