Jump to content

Do Images in Display: none Divs load?


Zeradin

Recommended Posts

Something else must be wrong with your code, as even if they didn't load when you set them to display:none (which I've done tests in the past to confirm that they do), they would definitely load when setting them to have a size of 1x1, since they are visible at that point.

Something else must be wrong with your code, as even if they didn't load when you set them to display:none (which I've done tests in the past to confirm that they do), they would definitely load when setting them to have a size of 1x1, since they are visible at that point.

 

Well I mean they aren't visible, they're visibility: hidden. What could possibly be wrong with the code? When I inspect it with firebug they still show up so the link to the image works... I don't get it.

<a href="#" id="resume_button"></a>
<div class="preload">
<img src="buttons/sadbbq_button.jpg" alt="saddbbq_button" />
<img src="buttons/facebook_button.jpg" alt="facebook_button" />
<img src="buttons/resume_button.jpg" alt="resume_button" />
</div>

 

a#resume_button:hover {
background: url(buttons/resume_button.jpg) no-repeat;
}
.preload {
display:none;
}

 

Maybe hovers always take a second to load the first time even if the image is already loaded?

visibility:hidden isn't the same as display:none. I believe they don't load with visibility:hidden.

 

But, as to your problem at hand, rather than going on in the direction you are going, you should switch to using CSS sprites, which combines both images into one, and just shifts the background position on rollover, guaranteeing that both images are loaded. This will both solve your problem, and increase page loading speeds.

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.