如何动态添加wmode = transparent到Youtube嵌入代码? [英] How to dynamically add wmode=transparent to Youtube embed code?
本文介绍了如何动态添加wmode = transparent到Youtube嵌入代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有几个由客户通过CMS添加的Youtube视频。我需要将以下内容添加到所有Youtube src链接中:
I have several Youtube videos that are added through a CMS by a client. I need to add the following to all Youtube src links:
?wmode=transparent
我该怎么做?
Youtube嵌入代码示例如下:
An example of the Youtube embed code is as follows:
<iframe width="515" height="292" src="http://www.youtube.com/embed/p8IB-5PbL9U" frameborder="0" allowfullscreen></iframe>
这样做的原因是因为我有一个jout菜单落后于Youtube视频而我已经读过这就是你解决它的方法。
The reason for doing this is because I have a javascript menu that is going behind a Youtube video and I've read that this is how you fix it.
客户端根本不是技术人员而只是让他们从Youtube获取嵌入代码是一场斗争,所以它需要动态添加。
推荐答案
如果你只需要添加 ?wmode =透明
到所有帧,有这个JS代码:
If you just need to add ?wmode=transparent
to all the frames, have this JS code:
window.onload = function() {
var frames = document.getElementsByTagName("iframe");
for (var i = 0; i < frames.length; i++) {
frames[i].src += "?wmode=transparent";
}
}
这篇关于如何动态添加wmode = transparent到Youtube嵌入代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文