Basically I need to overlay a div
over my HTML 5 video.
I Googled, and found the solution would be to set the div z-index
value to maximum. So, I did but the problem is with Firefox. When ever the video goes to full screen in Firefox my div
goes below video not over it.
http://codepen.io/anon/pen/GNaEKL I've made this link, You can test it in Firefox and click on that green box in it and see the result by yourself.
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>