I'd like to try this preload img script found on a previous stackoverflow question- Preloading images with jQuery
for clarification's sake, my image path is img/bg/image1.jpg will I need to change anything in this script for it to work? Also, do I need any other files like a specific jquery version? How can I test that it is working?
function preload(arrayOfImages) {
$(arrayOfImages).each(function(){
$('<img/>')[0].src = this;
// Alternatively you could use:
// (new Image()).src = this;
});
}
preload([
'img/imageName.jpg',
'img/anotherOne.jpg',
'img/blahblahblah.jpg'
]);