Note: I've seen this not work - especially with WordPress sites that have caching plugins installed.
<div class="hidden">
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var images = new Array()
function preload() {
for (i = 0; i < preload.arguments.length; i++) {
images[i] = new Image()
images[i].src = preload.arguments[i]
}
}
preload(
"http://domain.com/path-to-image1.jpg",
"http://domain.com/path-to-image2.jpg",
"http://domain.com/path-to-image3.jpg"
)
//--><!]]>
</script>
</div>
Dev & Tech Notes
San Diego | Los Angeles | Big Bear | USA
Terms & Conditions ©2005-2024 TJohns.co
Terms & Conditions ©2005-2024 TJohns.co
Top Left Text cha
Web & App Development
Preload Images with Javascript
- Details
- Written by Timothy Johns
- Category: Javascript
- Hits: 1221
Comments