Fancybox 2.1.0从图库中排除触发图像

可能重复:
Fancybox多个链接到同一个库,没有重复

我正在使用带有jQuery 1.8.3的fancybox 2.1.0来加载一个图像库,但它并不像我想要的那样工作。 我有一个大的主图像,然后是一组画廊缩略图。 单击主图像或缩略图可打开fancybox库。

问题是主要图像也是缩略图中的特征,因此当图库被启动时,我会得到第一个重复的图像:https://stackoverflow.com/questions/14338490/fancybox-2-1-0-exclude-trigger-image-from-gallery/1.jpg,https://stackoverflow.com/questions/14338490/fancybox-2-1-0-exclude-trigger-image-from-gallery/1.jpg,https://stackoverflow.com/questions/14338490/fancybox-2-1-0-exclude-trigger-image-from-gallery/2.jpg,https://stackoverflow.com/questions/14338490/fancybox-2-1-0-exclude-trigger-image-from-gallery/3.jpg等。

我希望主图像触发画廊灯箱但不包含在其中,但我似乎无法正确使用它。 非常感谢任何建议!

我的标记:

    

我的剧本:

 var $j = jQuery.noConflict(); $j(document).ready(function() { $j('.fancybox').fancybox({ nextEffect: 'fade', prevEffect: 'fade', helpers: { title : { type : 'float' } } }); }); 

试试这个:html(删除main img中的fancybox类)并将rel追加到data-fancybox-group

      

JS

  $('a.product-image').click(openFancybox); function openFancybox(){ $.fancybox.open($(this).attr('data-fancybox-group-rel')); } 

请参阅这里的 API API方法[很酷,这段代码没有经过测试];)祝你好运