Interesting idea Cherry,

Have you noticed whether the imagefree.css starts to load anyway
before the href is changed to gotimages.css? (I'd expect the if-
statement to run before the load() callback function).  In IE you
could try the error event as the alternative condition. Can't remember
what the alternative would be in FF etc.  Also, to save on markup
could you use a closure for your imagecheck value instead of an
element? (eg: var imagecheck = false; at the start of your imagesOn
function)

Just some initial thoughts. Cheers,

George

On Feb 15, 11:55 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I finally finished it ....
>
>  // detect whether images are on
> // and change styles accordingly
> jQuery.imagesOn = function(){
>
>      $('<img src="' + '/images/bgimage.jpg' + '#' + Math.random() + '"/>' 
> ).load(function() {
>
>           $('#noimages').attr("href", '/styles/gotimages.css');
>           $('.imagecheck').html('On');
>      });
>
>      if ( $('.imagecheck').val() != 'On' ) {
>           $('#noimages').attr("href", '/styles/imagefree.css');
>      }
>
> }
>
> (hack:  there is a hidden paragraph to hold the 'variable')
>
> Cherryhttp://jquery.cherryaustin.com

Reply via email to