Skip to content

Instantly share code, notes, and snippets.

@Viroide
Created September 18, 2015 10:10
Show Gist options
  • Select an option

  • Save Viroide/80052bb057f695ee7dd4 to your computer and use it in GitHub Desktop.

Select an option

Save Viroide/80052bb057f695ee7dd4 to your computer and use it in GitHub Desktop.
To preload a number of backgrounds that are named like "background-*.png"
$.preloadImages = function(cantidad) {
for (var i = 0; i < cantidad; i++) {
$("<img />").attr("src", "/path/background-"+i+".png");
}
}
$.preloadImages(10); //number of backgrounds
@Viroide
Copy link
Copy Markdown
Author

Viroide commented Sep 18, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment