When a user clicks on a small thumbnail image I then want a larger div element on the same page to then display that image. So far that works with the following code:
$(document).ready(function () {
$("img#thumb").click(function () { //when image with ID thumb is clicked change src
var imgpath = $(this).attr("src");
$("img#cover").attr("src", imgpath);
});
});
However I now want the old image to fade out while simultaneously switching the new one depending on whichever thumbnail the user clicks. I track the thumb clicked by making jQuery save the src file to a variable then put that in a new path using .attr()
How can I do this?
Not sure i catched what you need but this should be ok, try :