Created
May 13, 2014 19:33
-
-
Save ahmu83/bf46b704f02a9e1a3922 to your computer and use it in GitHub Desktop.
jQuery: preload an image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var src = "http://placekitten.com/500/500", | |
img = $("<img />"); | |
img.hide().attr("src", src); | |
img.load(function() { | |
// Image is loaded | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment