Preload images using jquery
Posted
by
OddOneOut
on Stack Overflow
See other posts from Stack Overflow
or by OddOneOut
Published on 2010-12-22T06:50:39Z
Indexed on
2010/12/22
6:54 UTC
Read the original article
Hit count: 194
jQuery
In my web page some images are taking a lot of time to load in IE.So I used this for preloading images in my page.But still the problem persists.Any suggestions?
function preload(arrayOfImages) {
$(arrayOfImages).each(function(){
$('<img/>')[0].src = this;
});
alert("Done Preloading...");
}
// Usage:
preload([
'/images/UI_1.gif',
'/images/UI_2.gif',
'/images/UI_3.gif',
'/images/UI_4.gif',
'/images/UI_5gif',
'/images/UI_6.gif',
'/images/UI_7.gif',
'/images/UI_8.gif',
'/images/UI_9.gif'
]);
<
div>
© Stack Overflow or respective owner