微信小程序 video组件----真机测试position:fixed无效 且有黑底

一、问题描述微信

  video组件fixed后,视频随页面滚动,且有个黑色底停留在页面。微信开发

  页面滚动前ide

  

  

  滚动后工具

 

这里贴一下修改前代码,在微信开发者工具看是没有任何问题的。在手机端测试就有以上的问题测试

<view style='position:fixed;top:3%;left:5%;overflow:hidden;'>
      <video src='http://video.699pic.com/videos/95/44/45/5FrIddfDqFze1528954445.mp4' enable-danmu danmu-btn controls objectFit="fill" style='width:300px;height:300px;'></video>
</view>


<view>
      <view style='width:100%;height:500px;'>sadsadsad</view>
      <view style='width:100%;height:500px;'>sadsadsad</view>
      <view style='width:100%;height:500px;'>sadsadsad</view>
      <view style='width:100%;height:500px;'>sadsadsad</view>
      <view style='width:100%;height:500px;'>sadsadsad</view>
</view>

 

二、解决办法spa

  将滑动的内容用scroll-view包裹,而且给一个固定的高度,这个高度最高不要用百分比,有时不会起做用,修改后的代码以下code

<view style='position:fixed;top:3%;left:5%;overflow:hidden;'>
      <video src='http://video.699pic.com/videos/95/44/45/5FrIddfDqFze1528954445.mp4' enable-danmu danmu-btn controls objectFit="fill" style='width:300px;height:300px;;'></video>
</view>


<scroll-view scroll-y='true' style='height:667px;'> 
      <view style='width:100%;height:500px;'>sadsadsad</view>
      <view style='width:100%;height:500px;'>sadsadsad</view>
      <view style='width:100%;height:500px;'>sadsadsad</view>
      <view style='width:100%;height:500px;'>sadsadsad</view>
      <view style='width:100%;height:500px;'>sadsadsad</view>
</scroll-view>
相关文章
相关标签/搜索