Let's say we have a slideshow of pictures. the thumbnails of those pictures are showed in div wrapper with a slider (that I created with Jquery) and each image is included in a <li>
with a CSS background set, which of course represents the image. I chose to use a background-image for a layout matter because they all are different in size and aspect ratio.
The images comes from a db and are dynamically created.
What I wanna do is:
show a "loading" message over every <li>
and wait until the background(image) is loaded in the cache and then show it with a fadeIn.
They only way I can think of (not that I can since I'm not very sure how and if its doable) is:
- temporally unset the background for every
<li>
while showing the "loading" message - make a loop for every background to get the image url
- use the $.get function to load it and then do whatever I want after loading
Beside the doable thing, this would imply they would load in sequence so if one won't load for some reason the script will never continue!
I've seen some sites that use JS to load images only when its visible by the browser, maybe this could be the same case I'm looking for, since I'm using a scroller and only a part of the images are showed at once and when the page loads