sugan Posted March 19, 2008 Share Posted March 19, 2008 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 More sharing options...
Synook Posted March 19, 2008 Share Posted March 19, 2008 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 More sharing options...
sugan Posted March 21, 2008 Author Share Posted March 21, 2008 hey,I tried but it is not working. Is there anyother solution.Regards,Suganya Link to comment Share on other sites More sharing options...
jeffman Posted March 21, 2008 Share Posted March 21, 2008 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 More sharing options...
jesh Posted March 21, 2008 Share Posted March 21, 2008 (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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.