Infinite Recursion using callback function in jQuery
<p>Experimenting with jQuery and trying to make a small slide show that rotates through three images.  Here's my HTML:</p>

<pre><code>&lt;div id="slideShow"&gt;
    &lt;img src="images/slides/slide1.jpg" width="520" height="230" /&gt;
    &lt;img src="images/slides/slide2.jpg" width="520" height="230" /&gt;
    &lt;img src="images/slides/slide3.jpg" width="520" height="230" /&gt;       
 &lt;/div&gt;
</code></pre>

<p>And here's the script:</p>

<pre><code>$(function ()
{
    var $slides = $('#slideShow img').hide(),
    slideIndex = 0;

    slideTransition = function ()
    {
        slideIndex++;
        (slideIndex == $slides.length) ? slideIndex = 0: null;
        $slides.eq(slideIndex).fadeIn(3000);
        $slides.eq(slideIndex).fadeOut(3000,slideTransition);
    }

    $slides.eq(0).fadeIn(3000);
    $slides.eq(0).fadeOut(3000, slideTransition);

});
</code></pre>

<p>This actually works fine, but my gut is telling me that having the infinite recursion is a bad thing.  Any suggestions on how to do this better?</p>
