Skip to content

Instantly share code, notes, and snippets.

@tdreyno
Created March 26, 2009 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdreyno/86408 to your computer and use it in GitHub Desktop.
Save tdreyno/86408 to your computer and use it in GitHub Desktop.
var preloadCount = 0;
function preloadEvent() {
preloadCount++;
if (preloadCount >= 2) {
// Show the images
}
}
var image1 = new Image();
image1.onload = preloadEvent;
var image2 = new Image();
image2.onload = preloadEvent;
image1.src = "/images/image1.jpg";
image2.src = "/images/image2.jpg";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment