Skip to content

Instantly share code, notes, and snippets.

@GuiSevero
Last active August 29, 2015 14:06
Show Gist options
  • Save GuiSevero/5d722694efec3c96567b to your computer and use it in GitHub Desktop.
Save GuiSevero/5d722694efec3c96567b to your computer and use it in GitHub Desktop.
Preloading images with javascript
<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(
baseUrl + "/imgs/romantic/bg-romantic.jpg",
baseUrl + "/imgs/culture/bg-culture.jpg",
baseUrl + "/imgs/adventure/bg-adventure.jpg"
)
//--><!]]>
</script>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment