我有一个缩略图库,当您单击它们时会显示更大的版本。我希望那个更大的图像在点击时出现在灯箱中。在页面加载时,显示的初始图像工作正常。但是,当我单击其中一个缩略图时,虽然它显示为较大的图像,但灯箱仅显示原始图像。我是否缺少一些代码,或者这可能是灯箱的限制?
<a href="/uploads/portfolio/fullsize/bigimage.jpg" id="bigImgLink" rel="lightbox"><img src="/uploads/portfolio/fullsize/bigimage.jpg" alt="" class="fullsize" id="bigImg" /></a>
Javascript 的片段
imagearray = new Array('CapitalHealth_01alt_WEB-2225.jpg','CapitalHealth_16_WEB-1311.jpg','CapitalHealth_18retouched_WEB-6133.jpg','CapitalHealth_09_retouched_WEB-6020.jpg','CapitalHealth_13_WEB-8373.jpg');
currentimage = 0;
totalimages= imagearray.length;
$(".navigation").click(function() {
if ( $(this).attr('id') == 'previous-image' ) {
currentimage = (currentimage > 0) ? currentimage - 1 : totalimages - 1;
} else {
currentimage = (currentimage < (totalimages - 1)) ? currentimage + 1 : 0;
}
$("img#bigImg").attr('src',"/uploads/portfolio/fullsize/" + imagearray[currentimage]);
$("a#bigImgLink").attr('href',"/uploads/portfolio/fullsize/" + imagearray[currentimage]);
});