【发布时间】:2016-12-24 18:21:44
【问题描述】:
基本上我需要在我的 HTML 5 视频上覆盖 div。
我用谷歌搜索,发现解决方案是将div z-index 值设置为最大值。所以,我做到了,但问题出在 Firefox 上。当视频在 Firefox 中全屏显示时,我的 div 会低于视频而不是超过它。
http://codepen.io/anon/pen/GNaEKL这个链接我做了,你可以在火狐中测试,点击里面那个绿色的框,自己看结果。
var video_con=document.getElementById("video_container");
document.getElementById("flscrn").addEventListener("click",function(){
alert("hi");
if (video_con.requestFullscreen) {
video_con.requestFullscreen();
} else if (video_con.mozRequestFullScreen) {
video_con.mozRequestFullScreen();
} else if (video_con.webkitRequestFullscreen) {
video_con.webkitRequestFullscreen();
}
});
.pofvv{
position:relative;
width:100%;
height:100%;
background:black;
z-index:1;
}
.vid{
position:absolute;
height:60px;
width:100%;
bottom:0px;
top:50%;
background: white;
z-index:2147483647;
}
.flscrn{
position:absolute;
height:30px;
width:130px;
background:green;
color:white;
text-align:center;
}
<div class="video_container">
<video class="pofvv" id="pofvv" controls>
<source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4">
</video>
<div class="vid">
<div class="flscrn" id="flscrn"> full screen </div>
</div>
</div>
【问题讨论】:
-
你可以做this.. 但我不完全确定你要做什么
-
你看过this answer吗?'
-
@adriancarriger 我说过要覆盖 div 不使用浏览器标准控件
标签: jquery html css firefox video