gpt4 book ai didi

jquery - YouTube嵌入播放器,避免使用zindex

转载 作者:行者123 更新时间:2023-12-03 05:43:00 26 4
gpt4 key购买 nike

我正在尝试将图像放置在youtube嵌入式播放器上。我通过jQuery将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>

最佳答案

您的iframe src中没有?rel=0。如果您从替换字符串中删除rel=0,它将起作用。

另外,您在var url = ...之后缺少分号终止符

编辑

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

关于jquery - YouTube嵌入播放器,避免使用zindex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12614782/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com