$(document).ready(function() {
$('#tapaintings a img').mouseenter(function() {
var fileNameForSrc = $(this).attr("src").replace(/^.*[\\\/]/, '');
$(this).attr("src", "images/" + fileNameForSrc);
});
$('#tapaintings a img').mouseleave(function() {
var fileNameForSrc = $(this).attr("src").replace(/^.*[\\\/]/, '');
$(this).attr("src", "images/thumbnails/" + fileNameForSrc);
});
});
The above is the jquery code that I am using now. It makes any image I have enlarge on mouseenter and return to it's normal size on mouseleave. I am wondering how I would make it so that when I mouseenter a thumbnail it would animate to the right of my gallery of photos. I am also worried of using the replace method because I believe that if I move the image that I enlarged to the right the function will automatically recognize that my mouse has left the image and revert to the smaller version of the image. By using the replace method is my thumbnail beneath the larger image and just invisible or is it actually as the name of the method implies, being replaced?
Here is my html:
<table id="tapaintings">
<tr>
<td><a id="painting1" href="images/painting1.jpg" rel="shadowbox[paintings]" title="painting1"> <img src="images/thumbnails/painting1.jpg" alt="painting"></a></td>
<td><a id="painting2" href="images/painting2.jpg" rel="shadowbox[paintings]" title="painting2"> <img src="images/thumbnails/painting2.jpg" alt="painting"></a></td>
</tr>
<tr>
<td><a id="painting3" href="images/painting3.jpg" rel="shadowbox[paintings]" title="painting3"> <img src="images/thumbnails/painting3.jpg" alt="painting"></a></td>
<td><a id="painting4" href="images/painting4.jpg" rel="shadowbox[paintings]" title="painting4"> <img src="images/thumbnails/painting4.jpg" alt="painting"></a></td>
</tr>
<tr>
<td><a id="painting5" href="images/painting5.jpg" rel="shadowbox[paintings]" title="painting5"> <img src="images/thumbnails/painting5.jpg" alt="painting"></a></td>
<td><a id="painting6" href="images/painting6.jpg" rel="shadowbox[paintings]" title="painting6"> <img src="images/thumbnails/painting6.jpg" alt="painting"></a></td>
</tr>
</table>