如何使 Youtube 上的视频不遮盖灯箱?
编辑:我以为我解决了它,但我没有。
我有 javascript 收集网页上的元素并将它们放在页面顶部的灯箱中。它适用于您的日常页面,但在 Youtube 上视频会显示出来。我查看并发现了 wmode =“透明”。所以我尝试过的是......
var youtubevideo = document.getElementsByTagName('link');
var len = youtubevideo.length;
for(var i=0;i<len;i++){
//youtubevideo[i].setAttribute('wmode', "transparent");
youtubevideo[i].href += "?wmode=transparent";
alert(youtubevideo[i].href);
}
警报验证了我在做我想做的事情时没有做错任何事。你还可以看到我在哪里注释掉了我尝试的另一种方式。有没有我没有找到的方法来实现这一目标?
Edit: I thought I solved it but I didn't.
I have javascript that gathers elements on a webpage and puts them in a lightbox on top of the page. It works fine for your every day page but on Youtube the videos show through. I looked and found out about wmode = "transparent". So what I have tried is...
var youtubevideo = document.getElementsByTagName('link');
var len = youtubevideo.length;
for(var i=0;i<len;i++){
//youtubevideo[i].setAttribute('wmode', "transparent");
youtubevideo[i].href += "?wmode=transparent";
alert(youtubevideo[i].href);
}
The alert verifies I am doing nothing wrong as far as doing what I intend to do. You can also see where I have commented out the other way I tried it. Is there a way I didn't find to accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现您需要重新加载视频。您可以通过将 src 复制到另一个变量,然后将 src 更改为“”,然后再次将 src 更改为保存原始 src 的变量来完成此操作。
I found out you need to make the video reload. You can do this by copying the src to another variable then change the src to "" and then change the src again to the variable you saved the original src in.