I'm writing a JS 'slideshow' (it's not a normal slideshow: the images change quickly so they have to be preloaded), and I'd like to have a loader
on while the images are preloading
.
To do this, I suppose I need to detect when each image is loaded (there's 36).
Right now I'm adding the images by appending the tags to the slideshow's main div
(and removing the default static image, which users without JS see), but please tell me if you think there's a better way of doing it.
Then they are shown to the user one at the time.
Is there a cross-browser 'native' way of detecting when the images have loaded?
Thank you, StackOverflow!
I think I found an acceptable solution on this site.
Still, I'd be happy if you could point out to me any bugs or ways to make the script better!
I did see he leaves out all the ;
...