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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

<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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.