此暂停vimeo嵌入代码在我的滑块脚本中放在哪里? [英] Where does this pause vimeo embed code go in my slider script?

查看:197
本文介绍了此暂停vimeo嵌入代码在我的滑块脚本中放在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Coda滑块将许多嵌入式Vimeo视频滑动到视图中,现在我需要在单击指向另一张幻灯片的链接时暂停每个视频.我正在使用iframe嵌入视频,并找到了能解决问题的代码: http://jsfiddle.net/ASa2K /4/

I'm using coda slider to slide a number of embedded Vimeo videos into view and I now need each video to pause when a link to another slide has been clicked. I'm embedding videos using an iframe and found this code which does the trick: http://jsfiddle.net/ASa2K/4/

尽管我的代码不同,但我不知道以下暂停脚本在Coda滑块JS文件中的位置:

My code is different though and I just don't know where the following pause script goes in my Coda slider JS file:

$("iframe").each(function() {
            this.contentWindow.postMessage('{ "method": "pause" }', "http://player.vimeo.com");
});

从以上文章中我还知道,我需要在嵌入代码中放入以下代码,以使其正常工作:

I also know, from the above post, that I need to put in the following code within the embed code for it to work correctly:

api=1

有人可以帮忙吗?我对JS没用.

Can someone help? I'm useless with JS.

这是我的滑块的JSFiddle: http://jsfiddle.net/qcJZY/

Here's the JSFiddle to my slider: http://jsfiddle.net/qcJZY/

推荐答案

我基本上是从.html页脚中获取原始初始化脚本的,并将其粘贴在主要的coda-slider.js文件的底部,然后将在此之前的以下代码似乎可以正常工作:

I basically took the original initialising script from the footer of my .html page, stuck it at the bottom of the main coda-slider.js file and put the following code beaneath it, seems to work:

$(window).bind("load", function() {
 $('#coda-slider-5').codaSlider({
   dynamicArrows: false,
   dynamicTabs: false
 });
});

var pauseVideos = function() {
 $("iframe").each(function() {
  this.contentWindow.postMessage('{ "method": "pause" }', "http://player.vimeo.com");
 });
};

$(function() {
$(".xtrig").bind("click", pauseVideos);    
});

这篇关于此暂停vimeo嵌入代码在我的滑块脚本中放在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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