-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideo.html
47 lines (39 loc) · 1.12 KB
/
video.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
var videoWidth = 1280;
var video = $(".video-container video").attr("srcdesk");
if($(window).width() < 721) {
videoWidth = 720;
video = $(".video-container video").attr("srcmob"));
}
$(".video-container video").attr("width", videoWidth).append('<source src="' + video + '" type="video/mp4" >'),
</script>
<style>
.video-container {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.video-container video {
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>
</head>
<body>
<div class="video-container">
<video autoplay loop muted playsinline width="1280" height="720" srcdesk="video.mp4" srcmob="video-mobile.mp4"></video>
</div>
</body>
</html>