Skip to content

Commit 1caf9b4

Browse files
committed
video project completed
1 parent 5e5afcf commit 1caf9b4

File tree

12 files changed

+641
-0
lines changed

12 files changed

+641
-0
lines changed

9-video/final/app.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const btn = document.querySelector(".switch-btn");
2+
const video = document.querySelector(".video-container");
3+
4+
const preloader = document.querySelector(".preloader");
5+
6+
window.addEventListener("load", function () {
7+
preloader.classList.add("hide-preloader");
8+
});
9+
10+
btn.addEventListener("click", function () {
11+
if (!btn.classList.contains("slide")) {
12+
btn.classList.add("slide");
13+
video.pause();
14+
} else {
15+
btn.classList.remove("slide");
16+
video.play();
17+
}
18+
});

9-video/final/index.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Video</title>
7+
8+
<!-- styles -->
9+
<link rel="stylesheet" href="styles.css" />
10+
</head>
11+
<body>
12+
<!-- preloader -->
13+
<div class="preloader">
14+
<img src="preloader.gif" alt="preloader" class="preloader__item" />
15+
</div>
16+
<!-- header -->
17+
<header>
18+
<video muted autoplay loop class="video-container">
19+
<source src="./video.mp4" type="video/mp4" />
20+
</video>
21+
<h1>video project</h1>
22+
<!-- video switch -->
23+
<button class="switch-btn">
24+
<span>
25+
play
26+
</span>
27+
<span>
28+
pause
29+
</span>
30+
<span class="switch"></span>
31+
</button>
32+
</header>
33+
<!-- javascript -->
34+
<script src="app.js"></script>
35+
</body>
36+
</html>

9-video/final/logo.svg

Lines changed: 17 additions & 0 deletions
Loading

9-video/final/preloader.gif

70.3 KB
Loading

9-video/final/styles.css

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
/*
2+
===============
3+
Fonts
4+
===============
5+
*/
6+
@import url("https://fonts.googleapis.com/css?family=Open+Sans|Roboto:400,700&display=swap");
7+
8+
/*
9+
===============
10+
Variables
11+
===============
12+
*/
13+
14+
:root {
15+
/* dark shades of primary color*/
16+
--clr-primary-1: hsl(205, 86%, 17%);
17+
--clr-primary-2: hsl(205, 77%, 27%);
18+
--clr-primary-3: hsl(205, 72%, 37%);
19+
--clr-primary-4: hsl(205, 63%, 48%);
20+
/* primary/main color */
21+
--clr-primary-5: #49a6e9;
22+
/* lighter shades of primary color */
23+
--clr-primary-6: hsl(205, 89%, 70%);
24+
--clr-primary-7: hsl(205, 90%, 76%);
25+
--clr-primary-8: hsl(205, 86%, 81%);
26+
--clr-primary-9: hsl(205, 90%, 88%);
27+
--clr-primary-10: hsl(205, 100%, 96%);
28+
/* darkest grey - used for headings */
29+
--clr-grey-1: hsl(209, 61%, 16%);
30+
--clr-grey-2: hsl(211, 39%, 23%);
31+
--clr-grey-3: hsl(209, 34%, 30%);
32+
--clr-grey-4: hsl(209, 28%, 39%);
33+
/* grey used for paragraphs */
34+
--clr-grey-5: hsl(210, 22%, 49%);
35+
--clr-grey-6: hsl(209, 23%, 60%);
36+
--clr-grey-7: hsl(211, 27%, 70%);
37+
--clr-grey-8: hsl(210, 31%, 80%);
38+
--clr-grey-9: hsl(212, 33%, 89%);
39+
--clr-grey-10: hsl(210, 36%, 96%);
40+
--clr-white: #fff;
41+
--clr-red-dark: hsl(360, 67%, 44%);
42+
--clr-red-light: hsl(360, 71%, 66%);
43+
--clr-green-dark: hsl(125, 67%, 44%);
44+
--clr-green-light: hsl(125, 71%, 66%);
45+
--clr-black: #222;
46+
--ff-primary: "Roboto", sans-serif;
47+
--ff-secondary: "Open Sans", sans-serif;
48+
--transition: all 0.3s linear;
49+
--spacing: 0.25rem;
50+
--radius: 0.5rem;
51+
--light-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
52+
--dark-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
53+
--max-width: 1170px;
54+
--fixed-width: 620px;
55+
}
56+
/*
57+
===============
58+
Global Styles
59+
===============
60+
*/
61+
62+
*,
63+
::after,
64+
::before {
65+
margin: 0;
66+
padding: 0;
67+
box-sizing: border-box;
68+
}
69+
body {
70+
font-family: var(--ff-secondary);
71+
background: var(--clr-grey-10);
72+
color: var(--clr-grey-1);
73+
line-height: 1.5;
74+
font-size: 0.875rem;
75+
}
76+
ul {
77+
list-style-type: none;
78+
}
79+
a {
80+
text-decoration: none;
81+
}
82+
img:not(.logo) {
83+
width: 100%;
84+
}
85+
img {
86+
display: block;
87+
}
88+
89+
h1,
90+
h2,
91+
h3,
92+
h4 {
93+
letter-spacing: var(--spacing);
94+
text-transform: capitalize;
95+
line-height: 1.25;
96+
margin-bottom: 0.75rem;
97+
font-family: var(--ff-primary);
98+
}
99+
h1 {
100+
font-size: 3rem;
101+
}
102+
h2 {
103+
font-size: 2rem;
104+
}
105+
h3 {
106+
font-size: 1.25rem;
107+
}
108+
h4 {
109+
font-size: 0.875rem;
110+
}
111+
p {
112+
margin-bottom: 1.25rem;
113+
color: var(--clr-grey-5);
114+
}
115+
@media screen and (min-width: 800px) {
116+
h1 {
117+
font-size: 4rem;
118+
}
119+
h2 {
120+
font-size: 2.5rem;
121+
}
122+
h3 {
123+
font-size: 1.75rem;
124+
}
125+
h4 {
126+
font-size: 1rem;
127+
}
128+
body {
129+
font-size: 1rem;
130+
}
131+
h1,
132+
h2,
133+
h3,
134+
h4 {
135+
line-height: 1;
136+
}
137+
}
138+
/* global classes */
139+
140+
.btn {
141+
text-transform: uppercase;
142+
background: transparent;
143+
color: var(--clr-black);
144+
padding: 0.375rem 0.75rem;
145+
letter-spacing: var(--spacing);
146+
display: inline-block;
147+
transition: var(--transition);
148+
font-size: 0.875rem;
149+
border: 2px solid var(--clr-black);
150+
cursor: pointer;
151+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
152+
border-radius: var(--radius);
153+
}
154+
.btn:hover {
155+
color: var(--clr-white);
156+
background: var(--clr-black);
157+
}
158+
/* section */
159+
.section {
160+
padding: 5rem 0;
161+
}
162+
163+
.section-center {
164+
width: 90vw;
165+
margin: 0 auto;
166+
max-width: 1170px;
167+
}
168+
@media screen and (min-width: 992px) {
169+
.section-center {
170+
width: 95vw;
171+
}
172+
}
173+
main {
174+
min-height: 100vh;
175+
display: grid;
176+
place-items: center;
177+
}
178+
/*
179+
===============
180+
Video
181+
===============
182+
*/
183+
.preloader {
184+
position: fixed;
185+
top: 0;
186+
left: 0;
187+
right: 0;
188+
bottom: 0;
189+
background: var(--clr-white);
190+
display: grid;
191+
justify-content: center;
192+
align-items: center;
193+
visibility: visible;
194+
z-index: 999;
195+
transition: var(--transition);
196+
}
197+
.hide-preloader {
198+
z-index: -999;
199+
visibility: hidden;
200+
}
201+
202+
header {
203+
min-height: 100vh;
204+
position: relative;
205+
display: grid;
206+
place-items: center;
207+
}
208+
.video-container {
209+
position: absolute;
210+
top: 0;
211+
left: 0;
212+
width: 100%;
213+
height: 100%;
214+
object-fit: cover;
215+
z-index: -2;
216+
}
217+
h1 {
218+
color: var(--clr-white);
219+
}
220+
/* switch button */
221+
222+
.switch-btn {
223+
position: absolute;
224+
bottom: 7%;
225+
left: 7%;
226+
width: 7rem;
227+
height: 2rem;
228+
display: flex;
229+
border-radius: var(--radius);
230+
align-items: center;
231+
justify-content: space-around;
232+
border: none;
233+
transition: var(--transition);
234+
}
235+
.switch-btn span {
236+
display: inline-block;
237+
font-size: 0.85rem;
238+
cursor: pointer;
239+
text-transform: capitalize;
240+
color: var(--clr-primary-5);
241+
}
242+
.switch {
243+
position: absolute;
244+
width: 50%;
245+
height: 100%;
246+
top: 0;
247+
left: 0;
248+
background: var(--clr-primary-5);
249+
border-radius: var(--radius);
250+
margin: 0;
251+
display: block;
252+
transition: var(--transition);
253+
}
254+
.slide .switch {
255+
left: 50%;
256+
}
257+
/* header after */
258+
header::after {
259+
content: "";
260+
position: absolute;
261+
top: 0;
262+
left: 0;
263+
width: 100%;
264+
height: 100%;
265+
background: rgba(0, 0, 0, 0.7);
266+
z-index: -1;
267+
}

9-video/final/video.mp4

5.79 MB
Binary file not shown.

9-video/setup/app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// MDN
2+
// The DOMContentLoaded event fires when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.
3+
// The load event is fired when the whole page has loaded, including all dependent resources such as stylesheets and images.

9-video/setup/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Video</title>
7+
8+
<!-- styles -->
9+
<link rel="stylesheet" href="styles.css" />
10+
</head>
11+
<body>
12+
<h1>video project</h1>
13+
<!-- javascript -->
14+
<script src="app.js"></script>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)