[jQuery] Re: Quick question on image loading

2009-10-07 Thread Mulyadi Oey
Related to this topic -- I have a page that: * Has a button whose background image will change upon rollover (done in CSS, using :hover) * Preloads the rollover image for the button above (done using a simple jQuery script) The page can be found at http://test.happypod.com/preloadimage/ The

[jQuery] Re: Quick question on image loading

2009-10-07 Thread Mulyadi Oey
Related to this topic -- I have a page that: * Has a button whose background image will change upon rollover (done in CSS, using :hover) * Preloads the rollover image for the button above (done using a simple jQuery script) The page can be found at http://test.happypod.com/preloadimage/ The

[jQuery] Re: Quick question on image loading

2009-10-07 Thread Mulyadi Oey
Yes, using a sprite can easily remedy the flickering problem during rollover. Unfortunately, it won't work in IE6 if you try to position a sprite PNG file that contains transparency -- this is a separate topic but you generally need to hack the transparent png file in order to keep the

[jQuery] Re: Quick question on image loading

2009-10-05 Thread Jonathan Sharp
Hi Eric, The browser will replace the image first before loading it. What you can do to preload the image is as follows: var newBackgroundImage = '/new/image/url.png'; $('img /') .attr('src', newBackgroundImage) .bind('load', function() { $('div').css('background-image', 'url(' +