Oops, set typing in motion before engaging brain .... Setting 'On' will defeat the object :o
What I mean to say is, I set the initial css to 'gotimages'. I still sometimes see a flash of the 'noimages' style (on a slow connection, with cache disabled) and will certainly be delighted if anyone comes up with a kosher solution! Cherry :) http://jquery.cherryaustin.com On Feb 16, 2:04 pm, "Richard D. Worth" <[EMAIL PROTECTED]> wrote: > The problem here is your .load callback will get called at some point in the > future, when the image finishes loading. However, the next line will get > executed immediately, without waiting for that. While this may work in some > cases (perhaps your tests), it may not if the image is too large or if the > server is slow in responding, for example. So, I don't think this is a good > test. > > > (hack: there is a hidden paragraph to hold the 'variable') > > A simple variable here works just as well: > > var imgOn = false; > > $('<img src="' + '/images/bgimage.jpg' + '#' + Math.random() + '"/>' > ).load(function() { > $('#noimages').attr("href", '/styles/gotimages.css'); > imgOn = true; > > }); > > alert(imgOn); > > But you have the same problem as above: your alert could very well fire > before the image is loaded, and the callback fired. > > - Richard