PM's Blog

Pramod Mohanan's notes about ASP.NET, MVC, C#, SQL, jQuery, Bootstrap

Preloading Images using jQuery

pre-loading of images is especially useful when the images are huge and at the time of use/display you just want it to appear without any delay. The following simple jquery allows to pre load images

jQuery.preloadImages = function()
{
 for(var a = 0; a ").attr("src", arguments[a]);
 }
};
 
// Usage
$.preloadImages("
img1.jpg", "/different/path/im2.gif", "other/img3.png");

Leave a Reply

Your email address will not be published. Required fields are marked *

PM's Blog © 2018