Jump to content

preload images


sugan

Recommended Posts

Hi,I just want to preload my background header images, as they are large in size., it takes time to load.I used the below code:

if(document.images){  pic1= new Image(780, 150);   pic1.src='images/headd.gif';   pic2= new Image(364, 128);  pic2.src='images/b.gif'; }

But i dont any effect in it. wat to do?Pls helpRegards,Suganya

Link to comment
Share on other sites

Many browsers don't use document.images any more. Try removing the conditional

pic1= new Image(780, 150);pic1.src='images/headd.gif';pic2= new Image(364, 128);pic2.src='images/b.gif';

Link to comment
Share on other sites

What exactly do you mean "preload my background header images"?Are these images only asked to appear after a mouse click or other user event, or are they included in your HTML markup? If they are indeed background images that are expected to be visible when the page first loads, "preloading" them will not have a noticeable effect. Preloading is mostly used when an image will not be visible when the page first loads, such as rollover images or gallery images. (Apologies if I'm telling what you already know. The word "background" just got me thinking.)

Link to comment
Share on other sites

(Apologies if I'm telling what you already know. The word "background" just got me thinking.)
On that same note, if these are truly background images [i.e. CSS like background-image: url(6_logo.png) ], IE6 has a fun "feature" that will download that image every time an element uses that particular style, regardless of any pre-caching of the image.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...