var pos= 0, $imgs;
function slide(){ $imgs.eq( pos++ ).fadeOut("slow", function(){ if( pos == $imgs.length ) pos = 0; // rewind $imgs.eq( pos ).fadeIn("slow", slide ); }); ); // Wait for document ready to start the magic $(function(){ $imgs = $('img.foo'); slide(); }); Note that You should add some kind of namespacing/plugin structure to this (customization is a good idea too). Cheers -- Ariel Flesler http://flesler.blogspot.com On Aug 27, 4:33 pm, admi99 <[EMAIL PROTECTED]> wrote: > I'd like to do slideshow by myself but I've met some problems. > > This example is quite simplified: > var pos= 0; > slide = function(){ > currImg[pos].fadeOut("slow", function(){ > curImg[pos+1].fadeIn("slow", slide() ); > > } > > pos = pos + 1; > ); > > } > > It's wrong example because of recursion. > > How can it be made?