本文介绍了fancybox 2.0.4和Vimeo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难将新的fancybox(V.2.0.4 g81c12d7)与新的iframe vimeo嵌入代码集成在一起.有人有解决方案吗?

解决方案

是的,最简单的方法是使用新的vimeo的"通用播放器"来嵌入您的视频.

请按照以下步骤操作:

A).从vimeo页面中选择其中一个视频,然后选择图标"embed"(在视频上方).

B).获取如下所示的iframe代码:

<iframe src="http://player.vimeo.com/video/34792993?title=0&amp;byline=0&amp;portrait=0" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>

C).提取src属性的内容,并将其设置为链接的href,例如:

<a class="vimeo" href="http://player.vimeo.com/video/34792993?title=0&amp;byline=0&amp;portrait=0">open vimeo in fancybox</a>

D).然后,您的fancybox(v2.x)自定义脚本应如下所示:

<script type="text/javascript">
$(document).ready(function() {
 $(".vimeo").fancybox({
  width: 400,
  height: 225,
  type: 'iframe',
  fitToView : false
 });
});
</script>

通知:我从iframe代码中获得了widthheight.

更新(2013年6月25日):在fancybox(今天为v2.1.5)中观看vimeo视频的另一种简便方法是使用fancybox媒体助手.检查 https://stackoverflow.com/a/17202629/1055987 以获取更多参考.

i have a lot of difficulties to integrate the new fancybox (V.2.0.4 g81c12d7) with the new iframe vimeo embed code.does somebody have a solutions?

解决方案

Yes, the easiest way is to use the new vimeo's "universal player" to embed your videos.

Follow this steps:

A). From the vimeo page choose of one of your videos, then select the icon "embed" (over the video).

B). Get the iframe code that looks like:

<iframe src="http://player.vimeo.com/video/34792993?title=0&amp;byline=0&amp;portrait=0" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>

C). Extract the content of the src attribute and set it as the href of your link like:

<a class="vimeo" href="http://player.vimeo.com/video/34792993?title=0&amp;byline=0&amp;portrait=0">open vimeo in fancybox</a>

D). Your fancybox (v2.x) custom script then should look like:

<script type="text/javascript">
$(document).ready(function() {
 $(".vimeo").fancybox({
  width: 400,
  height: 225,
  type: 'iframe',
  fitToView : false
 });
});
</script>

Notice I got the width and height from the iframe code.

UPDATE (Jun 25th, 2013) : another easier and simple way to watch vimeo videos in fancybox (v2.1.5 as today) is using the fancybox media helpers. Check https://stackoverflow.com/a/17202629/1055987 for further reference.

这篇关于fancybox 2.0.4和Vimeo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 23:09