直接复制就可以跑
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<style>
.div1{
width:100%;
height:100px;
}
.div2{
width:100%;
height:500px;
border:1px solid red;
position: relative; // 相对定位
background-color:red ;
}
.pos2{
width:50px;
height:50px;
z–index:9999;
background: url(2.png) no-repeat;
background-size: 100% 100%;
position: absolute;
left:50%;
top:50%;
transform: translate(-50%, -50%);
}
</style>
</head>
<body>
<div class="div1">
<div class="div2">
<video id="video" width="100%" height="500" class="div3" controls>
<source src="test.mp4" type="video/mp4">
</video>
<div class="pos2">
</div>
</div>
<div class="div2">
<video id="video" width="100%" height="500" class="div3" controls>
<source src="test.mp4" type="video/mp4">
</video>
<div class="pos2">
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(".pos2").click(function(){
$(this).siblings()[0].play();
})
$("video").each(function (key, item) {
let a = $("video").get(key).addEventListener('play', function (e) {
$(this).siblings().hide();
});
let b = $("video").get(key).addEventListener('pause', function (e) {
$(this).siblings().show();
});
});
</script>
</script>
</html>