/ Published in: JavaScript
Thanks to Matt Farina
Also see similar snippet for preloading arbitrary content, e.g. media in content received via AJAX.
Also see similar snippet for preloading arbitrary content, e.g. media in content received via AJAX.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// preloading function of images jQuery.preloadImages = function() { for(var i = 0; i<arguments.length; i++) { jQuery("<img>").attr("src", arguments[i]); } }; // use like $.preloadImages("image1.gif", "/path/to/image2.png", "some/image3.jpg");
URL: http://www.innovatingtomorrow.net/2008/04/30/preloading-content-jquery