如何使用jQuery for iframe捕获点击事件? [英] How to capture click event with jQuery for iframe?
问题描述
我试图在视频播放时暂停主页上的滑块,以免滑动。请查看此处。
I'm trying to pause the slider on the homepage when a video is played so it doesn't keep sliding. Check it out here.
我试过添加一个 div
,并捕获 div
的点击事件,但这不起作用。它只是将事件传递给 iframe
我想。请注意, iframe
正在从Vimeo加载内容,而不是从我的网站加载。
I've tried adding a div
on top of it and capture the click events for the div
, but that doesn't work. It just passes the events on to the iframe
I suppose. Note that the iframe
is loading content from Vimeo, not from my site.
有关如何制作此内容的任何建议工作还是其他方式来播放视频时暂停滑块?我似乎处于一个没有选择的死胡同......
Any ideas on how to make this work, or any other way to pause the slider when the video is played? I seem to be at a dead end with no options...
推荐答案
好像使用Vimeo的API更容易注册玩家发起的事件。
It seems like it would easier to use Vimeo's API to register for events fired by the player.
一个例子可以在这里找到: https://github.com/vimeo/vimeo-api-examples/blob/master/moogaloop-api/javascript/froogaloop.html
An example can be found here: https://github.com/vimeo/vimeo-api-examples/blob/master/moogaloop-api/javascript/froogaloop.html
文档: http:// vimeo.com/api/docs/moogaloop
在行动: http://jsfiddle.net/u5jG6/
这篇关于如何使用jQuery for iframe捕获点击事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!