jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了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>

解决方法

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

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

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

您的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>

大佬总结

以上是大佬教程为你收集整理的jquery – 同一图库中的Fancybox图像和视频全部内容,希望文章能够帮你解决jquery – 同一图库中的Fancybox图像和视频所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: