brettsky07
asked on
Preloading Background Images
Hi experts. I have created a site with a css navigation similar to: http://css-tricks.com/video-screencasts/82-css-image-switcher/ But my images are larger and when the page is loaded it flickers through them all before landing on the right one.
Is there a good cross browser compatible way to avoid this? I have tried some hidden div css solutions but nothing seems to be working. Example of the issue I'm referring to: http://tinyurl.com/3jpyqx5
Any suggestions would be great. Thanks!
Is there a good cross browser compatible way to avoid this? I have tried some hidden div css solutions but nothing seems to be working. Example of the issue I'm referring to: http://tinyurl.com/3jpyqx5
Any suggestions would be great. Thanks!
ASKER
That takes the rollover functionality out of the side navigation... I have also tried "stacking" with zindex and changing but no luck.
If you want we can set the background with javascript
ASKER
i tried a few javascript already but sure if you have another suggestion.
<script>
window.onload = function() {
document.getElementById("h ome_one"). style.back ground = "../images/recycling.jpg";
document.getElementById("h ome_two"). style.back ground = "../images/automotive.jpg" ;
document.getElementById("h ome_three" ).style.ba ckground = "../images/vacuum.jpg";
document.getElementById("h ome_four") .style.bac kground = "../images/industrial_clea ning.jpg";
document.getElementById("h ome_five") .style.bac kground = "../images/emergency.jpg";
document.getElementById("h ome_six"). style.back ground = "../images/environmental.j pg)";
}
</script>
you need to remove all the background in the css file for the six link, we let the background for the main one
window.onload = function() {
document.getElementById("h
document.getElementById("h
document.getElementById("h
document.getElementById("h
document.getElementById("h
document.getElementById("h
}
</script>
you need to remove all the background in the css file for the six link, we let the background for the main one
You can set the display to none and then using a document.ready function set them to visible.
ASKER
The images in the navigation dont appear at all when I use that code..
ASKER
EddieShipman: hmm ok. i havent tried that yet!
>The images in the navigation dont appear at all when I use that code..
I miss the URL keyword :
I miss the URL keyword :
window.onload = function() {
document.getElementById("home_one").style.background = "url(http://www.envirotec.ca/beta2/images/recycling.jpg)";
document.getElementById("home_two").style.background = "url(http://www.envirotec.ca/beta2/images/automotive.jpg)";
document.getElementById("home_three").style.background = "url(http://www.envirotec.ca/beta2/images/vacuum.jpg)";
document.getElementById("home_four").style.background = "url(http://www.envirotec.ca/beta2/images/industrial_cleaning.jpg)";
document.getElementById("home_five").style.background = "url(http://www.envirotec.ca/beta2/images/emergency.jpg)";
document.getElementById("home_six").style.background = "url(http://www.envirotec.ca/beta2/images/environmental.jpg)";
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That seems to be working! I'll work on implementing it and let you know if I have any issues. THanks!
Open in new window