I have one larger image with two smaller thumbnails beneath it - Marked up as follows:
<img src="../images/image.jpg" class="left main" alt="main image" />
<img src="../images/image2-thumb.jpg" class="left mainthumb" alt="image two" />
<img src="../images/image3-thumb.jpg" class="left thumb mainthumb" alt="image three" />
I would like when image2-thumb or image3-thumb is hovered over for it to change image.jpg to the hovered images src BUT without the -thumb.
so if i hover over image2-thumb.jpg then image.jpg becomes image2.jpg and so on. Then on mouseout I would like it to revert back to its original src.
I'm using the following javascript to currently do this but on click:
$(function () {
$('.mainthumb').click(function () {
$('.main').attr('src', this.src.replace('-thumb', ''))
});
});
I'd like to change this to hover but not sure how.