css - 在 UC 浏览器中重叠 div over html5 视频播放器问题

标签 css html uc-browser

是否可以在 UC 浏览器中将 div 元素重叠在 HTML5 视频播放器上。

<div class="test">
  <div class="goover"></div>
  <video width="400" controls>
    <source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">`
    Your browser does not support HTML5 video.
  </video>
</div>

fiddle

最佳答案

我假设您希望您的 div 与您的视频大小相同。 This thread有一个很好的答案给你。

setInterval(function() {
  var width = $("#vid").width();
  var height = $("#vid").height();
  $(".goover").css({
    'width': width,
    'height': height
  });
}, 10);
.test{
   position:relative
 }

.goover{
  width: 2px;
  height: 2px;
  border: solid 2px red;
  background: rgba(255,0,0,0.8);
  position: absolute;
  z-index: 10;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="test">
  <div class="goover"></div>
  <video width="400" id="vid" controls autoplay>         
    <source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
    Your browser does not support HTML5 video.
  </video>
</div>

我稍微修改了代码段以更好地匹配您的代码段。我还在红色背景中添加了一点透明度,这样您就可以看到 div 重叠在视频上。

编辑:

在 UC-Browser V6.1.2015.1007(目前最新版本)上测试,运行正常。

编辑2:

控件没有隐藏在 UC-Browser 中,通过添加 z-index 在 css 中修复了它。

编辑3:

我在视频标签上添加了自动播放属性,以查看它在播放模式下的工作情况。

关于css - 在 UC 浏览器中重叠 div over html5 视频播放器问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36888470/

相关文章:

javascript - 编辑布局以在元素之间使用垂直规则。

javascript - 自动从客户站点预填写网络表单

javascript - 如何在我的机器上的 Android Phone 中检查 UC 浏览器中的元素?

javascript - 相对于鼠标位置从其中心缩放图像

html - 多张背景图片

c# - 是否可以设置 asp.net gridview 单元格的背景?

python - 直播 RTSP 到 html 所有浏览器

html - 在两个并排的 Div 中将内容居中

css - uc浏览器设置背景图片高度