Posted By

neal_grosskopf on 04/11/11


Tagged

jquery facebook


Versions (?)

Who likes this?

11 people have marked this snippet as a favorite

neal_grosskopf
maltem
victorcastelan
scottwatkins
Balamir
choppingblock
lookingforsome
catrinho
unibox
Priestd09
Internet-Uzver


Emulate Facebook By Preloading Previous & Next Photo Gallery Images


 / Published in: jQuery
 

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.

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

Report this snippet  

You need to login to post a comment.