将 Div ID 添加到 YouTube iFrame
Add Div ID to YouTube iFrame
我正在尝试检测页面上是否有YouTube iframe,如果有,请添加一个div id,以便fitvids.js使其扩展到其容器。我无法让 js 将div id 附加到 iframe:
<script src="/js/jquery-1.10.2.js"></script>
<script src="/js/jquery.fitvids.js"></script>
<script>
$(window).load(function () {
$("iframe").attr('id','resp-video');
});
</script>
<script>
$(document).ready(function(){
$("#resp-video").fitVids();
});
</script>
$('iframe[src*="youtube.com"]').each(function() {
$(this).closest("div").attr("id","resp-video");
});
相关文章:
- 可以't从Youtube IFrame更改焦点
- Youtube iframe api未在YouTubeIframeAPIReady上触发
- 使用YouTube iFrame API的IE中的JavaScript问题
- 多个youtube iframe播放此内容
- Browserify breaks Youtube iFrame API
- 使用 javascript 收听 youtube iframe 事件
- Iframe|youtube Iframe上的移动后退按钮
- Youtube iframe API-重置音量
- 简单的Youtube iframe API就在文档中,我做错了什么
- Displaynone属性停止在Firefox中播放youtube iframe
- Youtube IFrame API来源不明
- YouTube iframe API and WordPress
- Youtube iFrame API pauseVideo在UIWebView中未定义
- 带有主干的Youtube IFrame API
- Youtube iFrame API无法控制播放器
- Youtube iframe没有响应通过上图传递的指针事件的点击:none
- 在页面加载后插入 YouTube iframe
- 没有全屏的iPhone 上的 YouTube Iframe API
- Youtube iFrame API 'YT is undefined'
- 如何从数组获取链接以在youtube Iframe API中播放