How about a self calling anonymous function:
$('#folio > :first').fadeOut(function() {
$(this).next().fadeOut(arguments.callee); });
Or if you're uncomfortable with that syntax, just make a function for it:
function fadeNext() {
$(this).next().fadeOut(fadeNext);
}
$('#folio > :first').fadeOut(fadeNext);
--Erik
On Wed, Oct 1, 2008 at 2:36 PM, ferdjuan <[EMAIL PROTECTED]> wrote:
>
> I'm trying to fade an element out, then fade it's next sibling out,
> with no predetermined amount of elements. Here is an example of how I
> have it now but with only 3 elements:
>
> function fadeEmOut(){
> var kid = $('#folio').children();
> kid.eq(0).fadeOut(function(){
> kid.eq(1).fadeOut(function(){
> kid.eq(2).fadeOut();
> });
> });
> }
>
> i KNOW there is a better way to write this, I attempted using the
> each() function but it fades every element simultaneously. When
> someone writes back with the answer I'm gonna feel like a tard. Thanks!
>