It doesn't seem like using img.src="" would work for background-image:url

claudiuiacob

03-03-2003, 09:39 AM

Go to that thread:

How do I know if preloading works? (http://www.codingforums.com/showthread.php?s=&threadid=15557)

It may help you.

joh6nn

03-03-2003, 10:10 AM

preloading works on the assumption that the images you're loading, aren't immediately visible to the user. example: mouse rollovers. the first image is not the one that gets preloaded. we only need to load that one normally. the one that needs to be pre-loaded, is the second image, the one that we display when we move our mouse over the "mouse-over" object. if we don't pre-load it, then there will be that short space of time, just after we've brought our mouse to rest on the mouse-over, where there's nothing to see while we wait for the image to download.

now, let's compare your scenario, to the mouse over scenario: you can't. as we stated before, pre-loading works on the assumption that the images you pre-load aren't immediately visible, and the image you're trying to preload here, is immediately visible. as such, you're not pre-loading it, you're just issuing a second command to load it.