TOP
EL EN
Images - Preload images
20 August 2024 Published by Aristotelis Pitaridis
Tools used for this tutorial
jQuery 3.7.1
SHARE

Sometimes it is very important to preload all the images so that the user will not wait when he makes an action which requires an image to be displayed.

function PreloadImages(Images) {
    $(Images).each(function(){
        $('<img/>')[0].src = this;
    });
}

PreloadImages([
    '/images/FirstImage.png',
    '/images/SecondImage.png',
    '/images/ThirdImage.png'
]);