Fancybox组图像没有重复

时间:2012-07-03 11:06:02

标签: jquery fancybox

如何使用fancybox对多个图像进行分组而不重复?我尝试过使用rel =“group”,尽管这会显示最近图像的列表。

我有以下HTML:

<ul>    
    <li>        
        <a rel="group1" class="fancy" title="Custom title" href="http://farm3.static.flickr.com/2641/4163443812_df0b200930.jpg">            <img alt="" src="http://farm3.static.flickr.com/2641/4163443812_df0b200930_m.jpg">        </a>        
        <h2><a rel="group1" class="fancy" title="Custom title" href="http://farm3.static.flickr.com/2641/4163443812_df0b200930.jpg">Test title about image</a></h2>    
    </li>    
    <li>        
        <a rel="group2" class="fancy" title="Custom title" href="http://farm3.static.flickr.com/2641/4163443812_df0b200930.jpg">            
            <img alt="" src="http://farm3.static.flickr.com/2641/4163443812_df0b200930_m.jpg">        
        </a>        
        <h2><a rel="group2" class="fancy" title="Custom title" href="http://farm3.static.flickr.com/2641/4163443812_df0b200930.jpg">Test title about image</a></h2>    
    </li>    
    <li>        
        <a rel="group3" class="fancy" title="Custom title" href="http://farm3.static.flickr.com/2641/4163443812_df0b200930.jpg">            
            <img alt="" src="http://farm3.static.flickr.com/2641/4163443812_df0b200930_m.jpg">        
        </a>        
        <h2><a rel="group3" class="fancy" title="Custom title" href="http://farm3.static.flickr.com/2641/4163443812_df0b200930.jpg">Test title about image</a></h2>    
    </li>    
    <li>        
        <a rel="group4" class="fancy" title="Custom title" href="http://farm3.static.flickr.com/2641/4163443812_df0b200930.jpg">            
            <img alt="" src="http://farm3.static.flickr.com/2641/4163443812_df0b200930_m.jpg">        
        </a>        
        <h2><a rel="group4" class="fancy" title="Custom title" href="http://farm3.static.flickr.com/2641/4163443812_df0b200930.jpg">Test title about image</a></h2>    
    </li>
</ul>    

2 个答案:

答案 0 :(得分:4)

您可以触发“喜欢”链接的点击事件,例如 - http://jsfiddle.net/K44HR/

(如果需要,调整jQuery选择器)

答案 1 :(得分:0)

现在不是那么容易:

<li>        
        <a rel="group1" class="fancy" title="Custom title" href="http://farm3.static.flickr.com/2641/4163443812_df0b200930.jpg">            
            <img alt="" src="http://farm3.static.flickr.com/2641/4163443812_df0b200930_m.jpg">        
        </a>        
        <h2><a rel="group2" class="fancy" title="Custom title" href="http://farm3.static.flickr.com/2641/4163443812_df0b200930.jpg">Test title about image</a></h2>    
    </li>