Skip to content

Commit 946e5d6

Browse files
committed
add modal and demo
1 parent 20a117f commit 946e5d6

File tree

4 files changed

+110
-2
lines changed

4 files changed

+110
-2
lines changed

100-hulu webpage clone/index.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,11 @@ <h3>Log In</h3>
230230
<div class="modal-footer">
231231
<p>Don't have an account? <a href="#">Start your free trial</a></p>
232232
</div>
233-
<img class="close" src="img/close.svg" alt="close" />
233+
<img
234+
class="close"
235+
src="https://github.com/bradtraversy/hulu-webpage-clone/blob/main/img/close.svg?raw=true"
236+
alt="close"
237+
/>
234238
</div>
235239
</div>
236240
<script src="script.js"></script>

100-hulu webpage clone/script.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const modal = document.querySelector(".modal");
2+
const loginButton = document.querySelector(".login-btn");
3+
const closeButton = document.querySelector(".close");
4+
5+
const openModal = () => (modal.style.display = "block");
6+
const closeModal = () => (modal.style.display = "none");
7+
const outsideClick = (e) => {
8+
if (e.target == modal) {
9+
closeModal();
10+
}
11+
};
12+
13+
loginButton.addEventListener("click", openModal);
14+
closeButton.addEventListener("click", closeModal);
15+
window.addEventListener("click", outsideClick);

100-hulu webpage clone/style.css

+89
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ h4 {
7474
border-color: #ccc;
7575
}
7676

77+
.btn-dark {
78+
color: #fff;
79+
background-color: #000;
80+
}
81+
7782
.legal-text {
7883
font-size: 10px;
7984
color: #ccc;
@@ -355,6 +360,90 @@ h4 {
355360
margin-right: 25px;
356361
}
357362

363+
/* Modal */
364+
365+
.modal {
366+
display: none;
367+
position: fixed;
368+
top: 0;
369+
left: 0;
370+
z-index: 1;
371+
height: 100%;
372+
width: 100%;
373+
background: rgba(0, 0, 0, 0.5);
374+
}
375+
376+
.modal-box {
377+
margin: 10% auto;
378+
width: 400px;
379+
background-color: #fff;
380+
color: #333;
381+
position: relative;
382+
animation: modalopen 1s;
383+
}
384+
385+
@keyframes modalopen {
386+
from {
387+
opacity: 0;
388+
}
389+
to {
390+
opacity: 1;
391+
}
392+
}
393+
394+
.modal-body {
395+
padding: 50px;
396+
}
397+
398+
.modal-body h3 {
399+
font-weight: bold;
400+
}
401+
402+
.modal-body .btn {
403+
width: 100%;
404+
margin-top: 30px;
405+
}
406+
407+
.modal .close {
408+
cursor: pointer;
409+
height: 23px;
410+
width: 23px;
411+
position: absolute;
412+
top: 20px;
413+
right: 20px;
414+
}
415+
416+
.modal .modal-footer {
417+
background-color: #f7f7f9;
418+
color: #333;
419+
padding: 20px 0;
420+
border-top: 1px solid #eee;
421+
text-align: center;
422+
}
423+
424+
.modal a {
425+
color: steelblue;
426+
}
427+
428+
/* Form */
429+
430+
.form-control {
431+
margin: 20px 0;
432+
}
433+
434+
.form-control label {
435+
display: block;
436+
text-transform: uppercase;
437+
}
438+
439+
.form-control input {
440+
width: 100%;
441+
border: 2px solid #ccc;
442+
border-radius: 5px;
443+
height: 50px;
444+
padding: 5px;
445+
}
446+
358447
/* Media Queries */
359448

360449
@media (max-width: 1300px) {

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
| 97 | [Terminal Style Landing Page](https://github.com/solygambas/html-css-fifty-projects/tree/master/97-terminal%20style%20landing%20page) | [Live Demo](https://codepen.io/solygambas/full/BaWvXLG) |
106106
| 98 | [Magazine Layout](https://github.com/solygambas/html-css-fifty-projects/tree/master/98-magazine%20layout) | [Live Demo](https://codepen.io/solygambas/full/OJpGMyj) |
107107
| 99 | [Parallax Website](https://github.com/solygambas/html-css-fifty-projects/tree/master/99-parallax%20website) | [Live Demo](https://codepen.io/solygambas/full/poeBdPr) |
108-
| 100 | [Hulu Webpage Clone](https://github.com/solygambas/html-css-fifty-projects/tree/master/100-hulu%20webpage%20clone) | [Live Demo](#) |
108+
| 100 | [Hulu Webpage Clone](https://github.com/solygambas/html-css-fifty-projects/tree/master/100-hulu%20webpage%20clone) | [Live Demo](https://codepen.io/solygambas/full/rNmmqBy) |
109109

110110
This repository is mostly based on 2 courses by Brad Traversy (2020):
111111

0 commit comments

Comments
 (0)