0

我在 shadowbox 显示正确图像时遇到问题。我有一个非常基本的图片库,其中包含小、中和大图像。以下是 jQuery 示例:

$('.product-gallery li a').click(function() {
    var imgmedium = $(this).children('img').attr('name');
    var imglarge = $(this).attr('rel');
    $('.product-main').children('a').children('img').attr('src',imgmedium);
    $('.product-main').children('a').attr('href',imglarge);
    return false;
});

现在这一切正常,我可以通过 DOM 判断所有必要的标签在点击时都会发生变化,但是 shadowbox 中始终打开的主图像是默认图像(不是通过 jQuery 加载的新图像)。

有没有解决的办法?

加载的 HTML:

<p class="product-main"><a href="images/test-product-1-large.jpg" rel="shadowbox"><img src="images/test-product-1-medium.jpg" alt="" width="420" height="587" /></a></p>

单击缩略图后,它变成了(正确地,我可以在 Firefox 中告诉这个查看选择源):

<p class="product-main"><a href="images/test-product-2-large.jpg" rel="shadowbox"><img src="images/test-product-2-medium.jpg" alt="" width="420" height="587" /></a></p>

然而,当我单击链接时,它会在 shadowbox 中打开原始的 product-1 图像(非常烦人)。

有任何想法吗?

更新:此处的示例页面 (http://www.adrianjacob.com/test/test.html)

固定:Shadowbox.clearCache(); Shadowbox.setup();

添加到jQuery函数:)

阿迪

4

0 回答 0