【发布时间】:2014-07-25 05:52:16
【问题描述】:
我需要在播放 youtube iframe 时触发一个事件。因此,当按下播放按钮时,我需要调用一个函数来隐藏 span.module-strip
我已经尝试过了,但也许我走错了路?
$("#home-latest-vid")[0].onplay = function() {
alert('hi');
};
HTML:
<div class="module module-home-video">
<span class="module-strip">Latest Product Video</span>
<iframe id="video" src="http://www.youtube.com/embed/RWeFOe2Cs4k?hd=1&rel=0&autohide=1&showinfo=0&enablejsapi=1" frameborder="0" width="640" height="360"></iframe>
</div>
【问题讨论】:
-
你想在哪里触发事件,在 iframe 代码中,还是在父代码中?
-
我想在父节点上触发事件
-
这可能会有所帮助:“从 iFrame 中获取元素”stackoverflow.com/questions/1088544/…
标签: javascript jquery youtube-api