Add files via upload
This commit is contained in:
parent
4307555974
commit
7c96301cd6
22
100_projects/100-background-video-pause-&-play/index.html
Normal file
22
100_projects/100-background-video-pause-&-play/index.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>The end</title>
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" />
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
|
||||||
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<Header>
|
||||||
|
<video class="background-video" muted autoplay loop src="pexels-clement-proust.mp4"></video>
|
||||||
|
<h1>WILL DONE</h1>
|
||||||
|
<button class="btn btn-secondary">
|
||||||
|
<i class="fa fa-pause" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
</Header>
|
||||||
|
<script src="main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
17
100_projects/100-background-video-pause-&-play/main.js
Normal file
17
100_projects/100-background-video-pause-&-play/main.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const btn = document.querySelector(".btn");
|
||||||
|
const video = document.querySelector(".background-video");
|
||||||
|
const fa = document.querySelector(".fa");
|
||||||
|
|
||||||
|
btn.addEventListener("click", () => {
|
||||||
|
if (btn.classList.contains("pause")) {
|
||||||
|
btn.classList.remove("pause");
|
||||||
|
video.play();
|
||||||
|
fa.classList.add("fa-pause");
|
||||||
|
fa.classList.remove("fa-play");
|
||||||
|
} else {
|
||||||
|
btn.classList.add("pause");
|
||||||
|
video.pause();
|
||||||
|
fa.classList.remove("fa-pause");
|
||||||
|
fa.classList.add("fa-play");
|
||||||
|
}
|
||||||
|
});
|
Binary file not shown.
25
100_projects/100-background-video-pause-&-play/styles.css
Normal file
25
100_projects/100-background-video-pause-&-play/styles.css
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
color: white;
|
||||||
|
letter-spacing: 0.277em;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
.background-video {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: -1;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
min-height: 100vh;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user