Click to See Complete Forum and Search --> : load certain images first


spirelli
03-17-2004, 04:47 AM
How can I make sure that certain images are loaded before the rest?
I'd like to know this in general.


Then I have also an example is here http://www.plessner.co.uk/homepage.html

An external document is loaded into a layer as a popup that can be closed. I'd like to have the two images in the popup load first so that it's complete. At the moment they seem to load last. Is this possible?

The layer with the document shows up in IE straight away. That's the way it should be. In Mozilla however the layer only shows up after the rest od the page has loaded. Bad. Can I change this with some script?

Thanks a lot for your help!

By the way, the original code comes from http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow.htm

Markus

David Harrison
03-17-2004, 07:11 PM
Try preloading the images, just put the following code in the head section of your page:



<script type="text/javascript"><!--

var preload=new Array();

preload[preload.length]=new Image();
preload[preload.length-1].src="img1.gif";

preload[preload.length]=new Image();
preload[preload.length-1].src="img2.gif";

//--></script>