PDA

View Full Version : Javascript Help: MM_preloadImages



iUnknown
16-07-2009, 12:09 PM
Hi,

I'm using the following code to preload images onload of the page:


<body onLoad="MM_preloadImages('image1.png','image2.png','etc.pn g')">

The code does exactly as expected in IE, but in firefox it simply doesn't seem to preload the images as it should?

Am I doing something wrong, or is there an alternative that will work in firefox?

Thanks very much.

Joe!
16-07-2009, 02:19 PM
Try using this, it looks quite good :)
http://net.tutsplus.com/freebies/plugins/jquery-plugin-preload-images/

iUnknown
16-07-2009, 04:46 PM
Try using this, it looks quite good :)
http://net.tutsplus.com/freebies/plugins/jquery-plugin-preload-images/

Is there not a simple preload technique or script that doesn't require me to install jquery and that script?

Edit:

Would this work:


function MM_preloadImages() { //v3.0
var d=document;
if(d.images){
if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){
d.MM_p[j]=new Image;
d.MM_p[j++].src=a[i];
}
}
}

Want to hide these adverts? Register an account for free!