添加视频
答
试试这个:
$(document).ready(function(){
$('.play').click(function() {
if($(this).parent().prev().get(0).paused){
$(this).parent().prev().get(0).play();
$(this).parent().prev().removeClass('blurEffect');
$('.content').hide();
}
});
$('.video').on('ended',function(){
$(this).addClass('blurEffect');
$('.content').show();
});
})
.wrapper {
position: relative;
display: inline-block;
}
.blurEffect {
-webkit-filter: blur(7px);
-o-filter: blur(7px);
-moz-filter: blur(7px);
-ms-filter: blur(7px);
filter: blur(7px);
}
.content {
position: absolute;
display: inline-block;
transform: translate(-50%,-50%);
top: 50%;
left: 50%;
color: #FFF;
width: 100%;
text-align: center;
z-index: 999;
}
.play {
font-size: 50px;
cursor: pointer;
border: 1px solid #FFF;
display: inline-block;
text-align: center;
padding: 5px 25px;
}
.play:hover {
color: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<div class="wrapper">
<video class="video blurEffect">
<source src=http://techslides.com/demos/sample-videos/small.webm type=video/webm>
<source src=http://techslides.com/demos/sample-videos/small.ogv type=video/ogg>
<source src=http://techslides.com/demos/sample-videos/small.mp4 type=video/mp4>
<source src=http://techslides.com/demos/sample-videos/small.3gp type=video/3gp>
</video>
<div class="content">
<div class="play">►</div>
<h1>Watch the movie</h1>
<p>Other text. Other text. Other text. Other text. </p>
</div>
</div>
答
我已经创建了一个简单的Codepen文档,它将指向正确的方向。它只使用HTML和CSS元素,只用最少的代码。
它还使用称为模糊的CSS滤镜来模糊背景图像,并使用比例增加图像的大小以忽略模糊滤镜应用的白色边框。
HTML
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<div class="wrapper"></div>
<div class="center">
<i class="fa fa-play" aria-hidden="true"></i>
<h1>Watch the others</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit enean semper mattis elementum/</p>
</div>
CSS
body {
padding: 0;
margin: 0;
}
.wrapper {
position: fixed;
background: url(https://static.pexels.com/photos/67636/rose-blue-flower-rose-blooms-67636.jpeg) no-repeat center center fixed;
background-size: cover;
width: 100%;
height: 100%;
filter: blur(10px);
transform: scale(1.1);
}
.center {
position: absolute;
text-align: center;
width: 100%;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 100%;
color: #fff
}
.center i {
font-size: 3em;
}
请提供一个最小的,完整的和可验证的Example.please阅读本https://stackoverflow.com/help/mcve不提供任何图像或视频的外部链接 – core114