Skip to content

Instantly share code, notes, and snippets.

@quawn
Last active March 10, 2017 15:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quawn/8560663 to your computer and use it in GitHub Desktop.
Save quawn/8560663 to your computer and use it in GitHub Desktop.
JS: Preload images
$.preloadImages = function() {
for(var i = 0; i<arguments.length; i++) {
$("<img />").attr("src", arguments[i]);
}
}
$(document).ready(function() {
$.preloadImages("hoverimage1.jpg","hoverimage2.jpg");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment