Rather than worrying about the alt function, you can give all your images a common class, say image-to-show
and create a loading div absolutely positioned over this image. So, when the page loads, you only show the loading div, with a loading gif, something like this:
// show loading image
$('.loader').show();
Once the image is loaded, you can hide the div and show the image.
// main image loaded ?
$('.image-to-show').load(function(){
// hide/remove the loading image
$('.loader').hide();
});
You can further enhance this code by using specific image ID's. Another, cleaner way to do it would be to set data-loading
to true for the images that are loading and once the images are loaded, set $('.image-to-show').data('loading', false)
There are multiple ways of tackling this, let me know if you need further clarification.
alt
text while loading the image). So I filed bugzilla.mozilla.org/show_bug.cgi?id=1472637 for Firefox so it hopefully behaves the same in the future. – Negligee