I got this snippet of code following a tutorial comment (by James) on Nettuts and I would like to implement it.
The tutorial method of preloading images is long winded but I liked James' shortened version of this, however, I have tried implementing this and I am not getting it right.
It seems I would need to set up my array first, the loop through that array which then creates the image objects and loads them. Yet, when I check my Firebug, I am not seeing any images load into the cache.
$(function(){
var imgArray = ['bghome01.jpg', 'bghome02.jpg', 'bghome03.jpg'];
$.preload = function (imgArray) {
$.each(imgArray, function () {
alert(imgArray);
(new Image()).src = 'Images/' + this;
});
};
});
I'd appreciate the help!