Javascript simply implements image preloading

  • 2020-03-30 04:26:18
  • OfStack

Simple image preload
Reloader. Js


var images = new Array();
 
function preloadImages(){
    for (i=0; i < preloadImages.arguments.length; i++){
         images[i] = new Image();
        images[i].src = preloadImages.arguments[i];
    }
}
preloadImages("logo.jpg", "main_bg.jpg", "body_bg.jpg", "header_bg.jpg", "jser.jpg");

As mentioned above, you can use your imagination and expand freely.


Related articles: