Response title
This is preview!
Image containers..
<div id='d1'><img class='img1' src='/picture/ShowFile/somepic.jpg/></div> <div id='d2'><img class='img2' src='/picture/ShowFile/somepic2.jpg' /></div>
In the doc ready...
$(".thumb").click( function () { src = $(this).attr("src").toString(); var newFile = src.replace("Thumb", "file"); changeImages(newFile );
});
Then changeImages:
function changeImages(name){ if(imgNum ==1) { $(".img2").attr("src", name).css("z-index", 200); $(".img1").css("z-index", 100).hide(1000) $(".img2").show(1000); imgNum=2; } else{ $(".img1").attr("src", name).css("z-index", 200); $(".img2").css("z-index", 100).hide(1000); $(".img1").show(1000); ingNum=1; } }
function changeImages(name) { $(".img1").stop(); $(".img2").stop(); if (imgNum == 1) { $(".img2").attr("src", name).css("z-index", 200); $(".img1").css("z-index", 100).animate({ opacity: 0 }, 500); $(".img2").animate({ opacity: 1 }, 500); imgNum=2; } else{ $(".img1").attr("src", name).css("z-index", 200); $(".img2").css("z-index", 100).animate({ opacity: 0 }, 500); $(".img1").animate({ opacity: 1 }, 500); ingNum=1; } }
© 2013 jQuery Foundation
Sponsored by and others.