I have a simple "loading" scenario with 2 images:
$('.img-loading').show();
// main image loaded ?
$('.the-big-img').hide().load(function () {
// hide/remove the loading image
$('.img-loading').hide();
$('.the-big-img').fadeIn();
});
However... this seems to work only most of the times. A few times I am left with the Loading image without the Big img displaying. I'm not sure in which cases the image doesn't show (they are all stored on my localhost and meet the same criteria).
If I hit F5/refresh on the pages where the Big img didn't load, they will load the second time.
Any thoughts?
UPDATE: Found some info here regarding Cache: jQuery .load() not firing on images (probably caching?)