noganno
9/14/2013 - 8:31 AM

URL: http://www.nealgrosskopf.com/tech/thread.php?pid=77 Ever notice how fast images load when paging through a Facebook photo album? Faceb

URL: http://www.nealgrosskopf.com/tech/thread.php?pid=77

Ever notice how fast images load when paging through a Facebook photo album? Facebook is preloading each of these images into your browser's cache before you even view them. Learn how to accomplish this using a couple lines of jQuery.

var nextimage = "/images/some-image.jpg";
$(document).ready(function(){
window.setTimeout(function(){
var img = $("<img>").attr("src", nextimage).load(function(){
//all done
});
}, 100);
});