HTML:
<div class="slide">
<div class="left">
<img src="img-lg.png" class="image1" />
</div>
<div class="thumbs">
<img src="img-sm.png" />
</div>
</div>
<div class="slide">
<div class="left">
<img src="anotherimg-lg.png" class="image1" />
</div>
<div class="thumbs">
<img src="anotherimg-sm.png" />
</div>
</div>
Jquery:
var originalContent = $('.left').html();
$("div.thumbs img").hover(function(){
var largesrc = $(this).attr("src").replace("sm","lg");
$(".left").html('<img src="' + largesrc
+ '" width="560" height="377" class="largeimage" />');
}, function() {
$(".left").html(originalContent);
});
I am replacing the large image with the smaller one on hover and then reverting back to the original. This works fine, but I can't figure out how to get it to work with multiple instances.
In the second slide set, the left image gets replaced by the original first left image and not the second.