Come on Dave don't be that precious :D
$C.fadeOut(
verbTime,
(function(str){
return function(){$THAT.text(str).fadeIn(verbTime);}
})(ARR[i])
);
On Wed, Aug 12, 2009 at 1:54 AM, Dave Methvin <[email protected]>wrote:
>
> > for(var i = 0; i<ARR.length; i++){
> > $C.fadeOut(
> > verbTime,
> > function(){$THAT.text(ARR[i]).fadeIn(verbTime);}
> > );
> > }
> > }
>
> That code has the same problem as the original, though. It is going to
> queue up ARR.length-1 fadeOut operations that all have i==ARR.length
> and fail. To get the code to work you need to create a closure
> *within* the loop that captures the current loop value, which
> jQuery.each does for you. Or am I missing something?
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---