On Jan 21, 2008, at 10:02 AM, Micky Hulse wrote:
A bit more info:
The hardest part for me to figure-out is the best approach for knowing
when all of the needed images are loaded... I think I can handle all
the
other aspects of the coding.
Is there a good technique for knowing when a group of images has fully
loaded?
One way would be to preload images sequentially one by one. When the
last one is loaded then you could be sure all images are fully loaded.
Something like:
-cut-
$(window).bind('load', function() {
var preload = new Array('image_1.png', 'image_2.png', 'image_3.png');
var img = document.createElement('img');
$(img).bind('load', function() {
if(preload[0]) {
this.src = preload.shift();
} else {
/* all images have been loaded */
}
}).trigger('load');
});
-cut-
--
Mika Tuupola
http://www.appelsiini.net/