> Simply wrap the code in a function:
>
> function myAnimate( el, css, speed, myZ ) {
> $(el).animate( css, speed, function(){
> $(el).css( zIndex: myZ );
> });
> }
>
> myAnimate( something, something, something, 10 );
>
> Now, when you call myAnimate, it captures that value of 10 in
> the myZ variable. That variable remains valid and accessible
> inside the animate callback function.
I didn't catch the typo in that, as John noted in the css() call. Or another
variation for that line:
$(el).css({ zIndex: myZ });
Also, as another example, back to your setTimeout code:
window.setTimeout(
function(arg1,arg2) {}
}, 100, arg1, arg2 etc );
How would you do this without the extra arguments to setTimeout? Very
simply:
function myTimeout( arg1, arg2 ) {
setTimeout( function() {
alert( arg1 + ' ' + arg2 );
}, 100 );
}
myTimeout( 'one', 'two' );
-Mike
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---