jQuery fancybox +无限轮播的Vimeo问题 [英] Vimeo problems with Jquery fancybox + infinite carousel

查看:183
本文介绍了jQuery fancybox +无限轮播的Vimeo问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

另一个来自JavaScript新手的与Vimeo相关的问题...

我在这里设置了问题: http://jsfiddle.net/ajtTF/

单击链接后,它将加载带有Jquery infinite轮播库的内联Fancybox模态.该画廊目前包括2个嵌入式Vimeo视频.

一切都很好,直到关闭了模态,然后重新启动.现在,由于某种原因,模态将第二个视频替换为第一个视频(即,显示同一视频的2个实例,而忽略另一个实例).

在这种情况下,我最终会想要几个视频.我不知道如果应用一些额外的js是否值得考虑.

在此先感谢您,我必须强调我的js技能几乎不存在,所以请保持清楚!随意弄乱我的例子.

解决方案

http://jsfiddle.net/ajtTF/6/

我不确定在关闭模态时为什么会清除iframe的src.

它似乎是您代码的一部分,所以我认为它与fancybox有关.

好吧,您的previos代码不起作用的原因是,当模态断开时,您从第一个iframe提取了src,然后在模态关闭时将其应用于两个iframe.

因此,当您打开agenn时,两个iframe上的src都相同.

此代码分别为每个帧保存src. 带有此代码的2个或10个iframe无关紧要.

GL

  'onComplete': function() {
    $("#inline2 iframe").each(function(i) {
     $(this).data("src", $(this).attr("src"));
    });
  }, 

  'onClosed': function() {
   $("#inline2 iframe").each(function(i) {
    $(this).attr("src", $(this).data("src"));
   });
  } 

Another Vimeo-related problem from a javascript noob...

I've set my problem up here: http://jsfiddle.net/ajtTF/

When the link is clicked, it will load up an inline Fancybox modal with a Jquery inifinite carousel gallery. The gallery currently consists of 2 embedded Vimeo videos.

All is fine, until the modal is closed, and then re-initiated. The modal now, for some reason, replaces the second video with the first video (ie, displays 2 instances of the same video, disregarding the other one).

I will eventually want several videos in this situation. I don't know if this is something worth taking into account if applying some additional js.

Many thanks in advance, and I must stress my js skills are pretty non-existent, so please be clear! Feel free to mess with my example.

解决方案

http://jsfiddle.net/ajtTF/6/

Hej im not sure why the src of the iframes are being cleared out when you close the modal.

It dosent seem to be part of your code so i asume it has something to do with fancybox.

Anny way the reason that you previos code didn't work is because you took the src from the first iframe when the modal loded, and then you applied it to both iframes when the modal closed.

so when you opened it agenn it had the same src on both iframes.

this code saves the src for each of the frames separately. It wont matter if you have 2 or 10 iframes with this code.

GL

  'onComplete': function() {
    $("#inline2 iframe").each(function(i) {
     $(this).data("src", $(this).attr("src"));
    });
  }, 

  'onClosed': function() {
   $("#inline2 iframe").each(function(i) {
    $(this).attr("src", $(this).data("src"));
   });
  } 

这篇关于jQuery fancybox +无限轮播的Vimeo问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆