My point was the recursion :) I know that it iterates wrong. my last post should be : >> pos++; > > if( pos == $imgs.length ) > > pos = 0; // rewind
On 28 Sie, 17:52, Ariel Flesler <[EMAIL PROTECTED]> wrote: > No, your code will hide and show back the last item. > If I'm wrong, the code I gave you works as expected. > > -- > Ariel Fleslerhttp://flesler.blogspot.com > > On Aug 28, 12:27 pm, admi99 <[EMAIL PROTECTED]> wrote: > > > Thank you :) However it isn't what I need :) > > At First : > > shouldn't it be more like that : > > > $imgs.eq( pos ).fadeOut("slow", function(){ > > > if( pos == $imgs.length ) > > pos = 0; // rewind > > else pos++; > > $imgs.eq( pos ).fadeIn("slow", slide ); > > }); > > > Secondly, > > stil there's recursion problem... > > > On 28 Sie, 16:36, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > > 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 Fleslerhttp://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?