Created
June 18, 2013 15:25
-
-
Save psflannery/5806310 to your computer and use it in GitHub Desktop.
Ever noticed how fast images load when paging through a Facebook photo album? This is because Facebook is preloading each of these images into your browser’s cache before you even view them. Here’s how you can achieve a similar behavior on your website using some jQuery magic. - http://www.nealgrosskopf.com/tech/thread.php?pid=77
This file contains hidden or 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 nextimage = "/images/some-image.jpg"; | |
$(document).ready(function(){ | |
window.setTimeout(function(){ | |
var img = $("<img>").attr("src", nextimage).load(function(){ | |
//all done | |
}); | |
}, 100); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment