On Nov 8, 10:53 am, Bil Corry <[EMAIL PROTECTED]> wrote:
> I played with it a bit.  It appears the anonymous functions being bound to 
> mousseover and mouseout don't have access to the functions outside themselves 
> when the page is first being loaded (perhaps they're not fully bound yet?).  
> Below is a simple test case, load it in Firefox, pop open Firebugs, place the 
> cursor over the "Test Span", hit Ctrl-R to reload the page and rapidly move 
> the cursor in/out of the "Test Span."  If you do, you'll see the error "xyzzy 
> is not defined" when the page is first loading, then the error goes away once 
> those anonymous functions have access to functions outside themselves.
>
> And the problem occurs regardless of the placement of JavaScript on the page; 
> it still happens when all the JavaScript is in the <head> as well.  One 
> work-around is to surround all the code contained within the anonymous 
> functions with try/catch, and simply ignore the errors.

Yeah, I stole an idea of doing some typeof $ check to see if it's
initialized, but I haven't got around to trying that out. But a try/
catch is an idea too.

What is confusing is why I can bind the event to the jquery-
initialized object but the action inside the event is confused.
Perhaps I can try replacing $(this) with $("#theactual div name")

It won't really make it a reusable function anymore, but hopefully it
will work properly.

This of course is just a tab/mouseover example. The bigger pain is
link actions that involve jquery being triggered early... we have a
login link that pops up a jqmodal window, and of course users see
login and want to login quick - I do it all the time. How can I bind
that event without using a jquery bind after the fact?

Reply via email to