Posted By

conspirator on 01/15/09


Tagged

textmate jquery preload ie6 images ihateie6


Versions (?)

Who likes this?

12 people have marked this snippet as a favorite

jelm
sulfurito
bryandease
acristic
indamix
mordecaix7
oldmeaty
seanpowell
aegony
guo3823538
wirenaught
protopropanol


Preload images using jQuery


 / Published in: JavaScript
 

  1. <script type="text/javascript" charset="utf-8">
  2. // JQUERY WAY TO PRELOAD IMAGES
  3. // DOES NOT NEED TO BE IN DOCUMENT READY
  4. $.preloadImages = function()
  5. {
  6. for(var i = 0; i<arguments.length; i++)
  7. {
  8. img = new Image();
  9. img.src = arguments[i];
  10. }
  11.  
  12. }
  13. $.preloadImages(
  14. "path/to/image/1",
  15. "path/to/image/2",
  16. "path/to/image/3"
  17. );
  18. </script>

Report this snippet  

You need to login to post a comment.