我正在尝试将图像放在youtube嵌入式播放器上。我通过jQuery将wmode=transparent
添加到url中,以允许玩家接受zindex。当它加载时,图像确实显示在播放器上,但是一旦页面完全加载,播放器就会返回到图像顶部。造成这种情况的原因是什么?
<iframe class="one" id="bottom" width="560" height="315" src="http://www.youtube.com
/embed/H7D4Ryi2ckg?list=SP0D260F7B6625A6BA&hl=en_US" frameborder="0"
allowfullscreen></iframe>
<img class="one" id="top" width="560" height="315"
src="http://images.nationalgeographic.com
/wpf/media-live/photos/000/005/cache/domestic-cat_516_600x450.jpg" alt="" >
<style type="text/css">
.one {position: absolute; top: 100px;}
#top{z-index: 9999;}
#bottom{z-index: 1;}
</style>
<script type="text/javascript" >
$(document).ready(function ()
$('iframe').each(function()
var url = $(this).attr("src")
$(this).attr("src",url+"?wmode=transparent")
);
);
</script>
答案 0 :(得分:0)
iframe src中没有?rel=0
。如果从替换字符串中删除rel=0
,则可以使用它。
此外,您在var url = ...
修改强> 的
修复语法错误后,它可以正常工作:meow