【发布时间】:2017-04-12 08:54:14
【问题描述】:
您好,我有一个允许图像和视频的滑块,
我正在尝试修复滑块上我的视频的叠加层 但是当我尝试它时,视频会停止播放,并且就像一个带有叠加层的图像 链接到我存在滑块的页面
http://whitechapelandpartners.com/flex/
这就是我正在尝试的,它给了我这个结果
信用:http://codepen.io/icutpeople/pen/whueK
.video-container {
position: relative;
}
video {
height: auto;
vertical-align: middle;
width: 100%;
}
.overlay-desc {
background: rgba(255, 0, 0, 0.37);
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
display: flex;
align-items: center;
justify-content: center;
}
<?php if($type == 'video'){?>
<div class="video-container">
<video width="320" height="240" controls>
<source src="<?php echo $row_slide['path']; ?>" type="video/mp4">
Your browser does not support the video tag.
</video>
<div class="overlay-desc">
<h1>Waynes World</h1>
</div>
</div>
<?php }?>
我的视频为什么停止播放的任何帮助
【问题讨论】:
-
尝试使用 z-index 覆盖 div
-
为什么您的视频标签中没有
autoplay属性,它在您提供的示例中。 -
好的让我试试
-
尝试使用这个
$('video').get(0).play()播放视频,这里给出了解释stackoverflow.com/a/26907606/2417602 -
很好用@solanke 请提出您的建议作为答案,以便我将其标记为正确答案
标签: javascript jquery html css