This works, but there must be a better way (without using a global var). fade = function(){ $(this).next().fadeIn(500,fade); }; $('#ul.menu li:first-child').fadeIn(500,fade);
On Sep 22, 5:34 pm, PaulC <[EMAIL PROTECTED]> wrote: > I'm new to jQuery so be gentle!! > > I have a menu list, and I want each li to fade in one at a time, I can > do this with the following code: > > $("ul.menu li:first-child").fadeIn(1000, function () { > $(this).next().fadeIn(1000, function () { > $(this).next().fadeIn(1000, function () { > $(this).next().fadeIn(1000, function () { > $(this).next().fadeIn(1000, function > () { > $(this).next().fadeIn(1000, > function (){ > > $(this).next().fadeIn(1000, function (){ > > $(this).next().fadeIn(1000); > }) > }); > }); > }); > }); > }); > }); > > As you can see its not nice! I'm sure there is a better way, > especially as the menu is dynamic so I'd never know how many items > there are. > > Any help or advice is appreciated.