2 replies [Last post]
samf
samf's picture
Offline
Enthusiast
Los Angeles, CA
Last seen: 8 years 12 weeks ago
Los Angeles, CA
Timezone: GMT-5
Joined: 2003-09-29
Posts: 106
Points: 34

Hi,

I have a tabbed interface, all on the same webpage. The problem is that the div's which are set to style="display:none" have images in them. Because they're not initially needed, IE (which my Intranet uses) does not bother to get them until I click on that tab, and the resepctive div gets set to style="display:block".

Is there any way to overcome this? I believe I recall using javascript to declare
var hiddenImage = new Image;
etc..
etc..
so that it's preloaded and ready, but I havent' seen that in a while.

Many thanks to you know know.

Sam Fullman

Life is complex -- don't make it complicated. If you need help with PHP visit PHP Builder

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 21 weeks 1 day ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Storing an image as an object so it preloads

img1 = new Image();
img1.src = "img/home_on.gif";

Whack that in an external javascript file (.js), link to it, and it will preload whatever image you use.

Verschwindende wrote:
  • CSS doesn't make pies

samf
samf's picture
Offline
Enthusiast
Los Angeles, CA
Last seen: 8 years 12 weeks ago
Los Angeles, CA
Timezone: GMT-5
Joined: 2003-09-29
Posts: 106
Points: 34

question about that

Good Idea, since these are small <1K files for borders. But do I need to link them to their locations in the style="display:none;" divs? Reason is, these are already present in visible tabs, just it takes a vew visible seconds for the images to pop in when you click the tabs sometimes.

Thanks,
Sam fullman

Life is complex -- don't make it complicated. If you need help with PHP visit PHP Builder