Preload images in Javascript 😁
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function newImage(arg) { if (document.images) { rslt = new Image(); rslt.src = arg; return rslt; } } function preloadImages() { newImage("bigphoto/kran.jpg"); newImage("bigphoto/z1.jpg"); newImage("bigphoto/z2.jpg"); newImage("bigphoto/truba.jpg"); newImage("bigphoto/put.jpg"); } |