function preloader() { // counter var i = 0; // create object imageObj = new Image(); // set image list images = new Array(); images[0]="/wp-content/uploads/2016/05/bkgHome1_small.jpg" images[1]="/wp-content/uploads/2016/05/bkgHome2_small.jpg" images[2]="/wp-content/uploads/2016/05/bkgHome3_small.jpg" images[3]="image4.jpg" // start preloading for(i=0; i<=3; i++) { imageObj.src=images[i]; } }