I have found a script here that preloads images, but I dont know how can to access them.
(function($) {
var cache = [];
// Arguments are image paths relative to the current page.
$.preLoadImages = function() {
var args_len = arguments.length;
for (var i = args_len; i--;) {
var cacheImage = document.createElement('img');
cacheImage.src = arguments[i];
cache.push(cacheImage);
}
}
})(jQuery)
In other words I would take chace[i] – when the preload finished – and append to a div. Any ideas?
You can use
loadevent. Example here.HTML:
Javascript: