Possible Duplicate:
jQuery check if image is loaded
I have a situation where I have the following markup:
<div class="image">
<img class="" src="content-images/1.jpg">
<span class="slide" rel="content-images/2.jpg"></span>
<span class="slide" rel="content-images/3.jpg"></span>
<span class="slide" rel="content-images/4.jpg"></span>
</div>
Now in the CSS all the children of div.image
are absolutely positioned so they're stacked on top of each other.
What I am doing is that, on a certain trigger, let's say when a button is clicked somewhere else on the page, to change the span
's to img
's with the src
set to the rel
in each span. The images are large high-res images so they could take a while to load completely.
Using javascript / jQuery I need to show a loading message / indicator from when the button is clicked to when all the span
's being replaced with img
's finish loading.
I can't use jQuery's .load()
because of known issues with images and cache etc.
I tried using imagesloaded but it doesn't seem to do what I need.
Is there any other way to do this you can think of?