Re: [jQuery] Closure/scope

2009-11-24 Thread Michael Geary
message.replace( 'setTimeout', 'setInterval' ); :-) On Tue, Nov 24, 2009 at 10:30 AM, Michael Geary wrote: > The problem is in your setTimeout() call. > > When you pass a string argument to setTimeout(), that string is evaluated > *in the global context*. > > Instead, pass a function to setTime

Re: [jQuery] Closure/scope

2009-11-24 Thread Michael Geary
The problem is in your setTimeout() call. When you pass a string argument to setTimeout(), that string is evaluated *in the global context*. Instead, pass a function to setTimeout() and that function will be executed in the scope you expect. Since you're just calling a single function anyway, yo

[jQuery] Closure/scope

2009-11-24 Thread Magnificent
Hello all, I'm trying to group some exisiting top-level functions inside a closure (to avoid polluting the global namespace) but I'm not quite getting it to work. First, all the JS works outside my anonymous function, but once I put it in the anonymous function I get an error of "crossfade is not