RadiantHex
RadiantHex

Reputation: 25567

Preloading images on IE7-IE8

I tried two different techniques:

url = 'http://domain.com/image.gif';
$('body').append('<img style="display:none" src="'+url+'" />');

and

image = Image(1,1);
image.src = 'http://domain.com/image.gif';

Images get preloaded in IE6, Chrome 8, Firefox 3.5+

but cannot get these to work in IE8 or IE7


Any ideas?

Upvotes: 1

Views: 1174

Answers (1)

Neil
Neil

Reputation: 3231

There's a jQuery plugin to do what you want.

Another way is to do your jQuery image processing only when the whole of the DOM, including the images themselves, has been loaded e.g. instead of

$(window).ready(function(){.....

use

$(window).load(function(){.....

See the documentation.

Upvotes: 1

Related Questions