Fancybox图像和视频在同一个图库中

use*_*091 5 markup jquery fancybox

我在弹出式画廊使用精美的盒子,但我遇到了问题.我希望在同一个图库中有图片和视频.我有一个缩略图显示在我的投资组合不同的工作,我们是一家设计和视频公司因此其重要的是,我在同一个弹出画廊两者都做的能力.有没有其他人遇到过这个问题?我想人们想要这样做是很常见的.

这是我的标记...我有相同的rel属性,所以他们在同一个库中,但我正在调用一个不同的脚本,以便可以正确设置类型.

$("a#brianguehring").fancybox();

$("a#brianguehring-video").fancybox({ 
    'type'          : 'swf',
    'transitionIn'      : 'none',
    'transitionOut'     : 'none',
});

<span>
<a class="grouped_elements icon_camera" rel="group-brian" id="brianguehring" title="Brian Guehring Website" href="images/portfolio/brianguehring-one.png"></a>
</span>

<span>
<a class="grouped_elements" rel="group-brian" id="brianguehring-video" title="Pasquale Vitello'Showreel 2010" href="http://vimeo.com/24081323">&nbsp;</a>
</span>
Run Code Online (Sandbox Code Playgroud)

Clo*_*ign 5

我在这里工作了.我假设您希望图像和视频在同一组中.我把这个工作示例放在JS Fiddle上 - http://jsfiddle.net/4pAQz/1/

你的JS调用看起来像这样.这一切都必须在一个电话中.

$(document).ready(function(e) {
$("a[rel=example_group]").fancybox({
    'transitionIn'      : 'none',
    'transitionOut'     : 'none',
    'titlePosition'     : 'over',
    'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
        return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
    }
});
});
Run Code Online (Sandbox Code Playgroud)

您的HTML将如下所示:注意:请注意,Vimeo播放器的href是player.vimeo.com/video/YourIDHere.不需要SWF代码.它只是有效.您还需要将锚点rel =""作为相同的名称,以便将对象放入同一组中.

<div>
 <a rel="example_group" 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>
 <a rel="example_group" title="Title of video here" class="various iframe" href="http://player.vimeo.com/video/24081323?title=0&amp;byline=0&amp;portrait=0">
 <img alt="" src="http://farm3.static.flickr.com/2591/4135665747_3091966c91_m.jpg" />
 </a></div>
Run Code Online (Sandbox Code Playgroud)