如何使用 jQuery 为 iframe 捕获点击事件? [英] How to capture click event with jQuery for iframe?

查看:29
本文介绍了如何使用 jQuery 为 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

文档:http://vimeo.com/api/docs/moogaloop

行动: http://jsfiddle.net/u5jG6/

这篇关于如何使用 jQuery 为 iframe 捕获点击事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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