I have this situation:
<div id="main_image">
<img src="images/big_image.png" alt="big image" width="300" height="300" />
</div>
<div id="thumbnails">
<a href="images/big1.png"><img src="images/thumb1.png" alt="thumb 1" /></a>
<a href="images/big2.png"><img src="images/thumb2.png" alt="thumb 2" /></a>
<a href="images/big3.png"><img src="images/thumb3.png" alt="thumb 3" /></a>
</div>
I change the big image src like this code:
$("#thumbnails a").hover(function() {
$("#main_image img").attr("src",$(this).attr("href"));
});
Before showing the new image, i want to show on the main_image div a loading image, beacuse like this script, if the new image is to big i must wait to render. How can i solve this situation?
Tnx
FOUND IT:
$('#additionals_image_carousel li a').mouseover(function() {
var href = $(this).attr("href");
$("#productMainImage img").fadeOut(function() {
$(this).load(function() { $(this).fadeIn(); });
$(this).attr("src", href);
});
});
and #productMainImage has a loading image as centered background