Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery Youtube嵌入播放器避免zindex_Jquery_Iframe_Youtube_Z Index_Youtube Javascript Api - Fatal编程技术网

Jquery Youtube嵌入播放器避免zindex

Jquery Youtube嵌入播放器避免zindex,jquery,iframe,youtube,z-index,youtube-javascript-api,Jquery,Iframe,Youtube,Z Index,Youtube Javascript Api,我正试图在youtube嵌入式播放器上放置一个图像。我通过jQuery向url添加了wmode=transparent,以允许播放器接受zindex。当它加载图像时,确实会显示在播放器上,但一旦页面完全加载,播放器将返回图像顶部。这是什么原因造成的 <iframe class="one" id="bottom" width="560" height="315" src="http://www.youtube.com /embed/H7D4Ryi2ckg?list=SP0D260F7B6

我正试图在youtube嵌入式播放器上放置一个图像。我通过jQuery向url添加了
wmode=transparent
,以允许播放器接受zindex。当它加载图像时,确实会显示在播放器上,但一旦页面完全加载,播放器将返回图像顶部。这是什么原因造成的

<iframe class="one"  id="bottom" width="560" height="315" src="http://www.youtube.com

/embed/H7D4Ryi2ckg?list=SP0D260F7B6625A6BA&amp;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>

.1{位置:绝对;顶部:100px;}
#顶部{z-索引:9999;}
#底部{z-索引:1;}
$(文档).ready(函数()
$('iframe')。每个(函数()
var url=$(this.attr(“src”)
$(this.attr(“src”,url+“?wmode=transparent”)
);
);

您的iframe src中没有
?rel=0
。如果从替换字符串中删除
rel=0
,则该选项有效

另外,在
var url=…

编辑


修复语法错误后,它可以正常工作:

我删除了该部分,但仍然不起作用。我更新了我问题的代码。奇怪的是,为什么Youtube嵌入需要&wmode=transparent,而其他嵌入(vimeo)不需要它来在上面创建div/dialogs?