-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It is a JS mini project which deals with the modal functionality made via DOM manipulation.. Any further modifications are welcome...
- Loading branch information
1 parent
6c35915
commit b1bca09
Showing
6 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## This is a mini JS project of JS modal window made with plain Java Script and it is all about DOM manipulation and settting up the outcomes with the CSS code. | ||
|
||
# Any modifications are welcomed here... |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!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>JS modal</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
<script src="https://kit.fontawesome.com/c7295c2588.js" crossorigin="anonymous"></script> | ||
</head> | ||
|
||
<body> | ||
<header class="hero"> | ||
<div class="banner"> | ||
<h1>Modal Project</h1> | ||
<button class="btn modal-btn">Open Modal</button> | ||
</div> | ||
</header> | ||
|
||
<!-- modal --> | ||
<div class="model-overlay"> | ||
<div class="modal-container"> | ||
<h3>Sorry, you haven't saved the file yet...</h3> | ||
<button class="close-btn"> | ||
<i class="fa fa-times"></i> | ||
|
||
</button> | ||
</div> | ||
</div> | ||
|
||
<!-- line no 27 and 18 of this page will be the target for JS DOM manipulation to optimize the code --> | ||
<script src="resp.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
modal-btn, modal-overlay, close-btn -- applied in JS | ||
|
||
open-modal-- applied to open the page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
modalBtn = document.querySelector(".modal-btn") | ||
modelOverlay = document.querySelector(".model-overlay") | ||
closeBtn = document.querySelector(".close-btn") | ||
|
||
|
||
modalBtn.addEventListener("click", function() { | ||
modelOverlay.classList.add("show-overlay") | ||
}) | ||
|
||
closeBtn.addEventListener("click", function() { | ||
modelOverlay.classList.remove("show-overlay"); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
* { | ||
margin: 0px; | ||
} | ||
|
||
.hero { | ||
height: 100vh; | ||
background: url("bg.jpg") no-repeat center; | ||
background-size: cover; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.banner { | ||
width: 500px; | ||
height: 300px; | ||
background: white; | ||
/* transform: translate(569px, 535px); */ | ||
border: 2px solid grey; | ||
border-radius: 10px; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
box-shadow: 2px 2px 3px black; | ||
} | ||
|
||
h1 { | ||
color: black; | ||
font-size: 4rem; | ||
} | ||
|
||
.btn { | ||
font-size: 1.5rem; | ||
margin: 40px; | ||
cursor: pointer; | ||
background-color: blue; | ||
color: white; | ||
border: 2px solid white; | ||
border-radius: 10px; | ||
padding: 5px; | ||
width: 200px; | ||
} | ||
|
||
.btn:hover { | ||
border: 2px solid grey; | ||
background: white; | ||
color: blue; | ||
} | ||
|
||
.model-overlay { | ||
position: fixed; | ||
top: 0px; | ||
left: 0px; | ||
right: 0px; | ||
width: 100%; | ||
height: 100%; | ||
display: grid; | ||
place-items: center; | ||
background: rgb(99, 138, 170); | ||
visibility: hidden; | ||
z-index: -9; | ||
} | ||
|
||
.modal-container { | ||
width: 500px; | ||
height: 300px; | ||
background: white; | ||
/* transform: translate(569px, 535px); */ | ||
border: 2px solid grey; | ||
border-radius: 10px; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
box-shadow: 2px 2px 3px black; | ||
} | ||
|
||
h3 { | ||
font-size: 2.4rem; | ||
} | ||
|
||
.fa { | ||
color: red; | ||
height: 10px; | ||
width: 24px; | ||
font-size: 2rem; | ||
} | ||
|
||
.close-btn { | ||
height: 37px; | ||
position: relative; | ||
top: -135px; | ||
left: 223px; | ||
border: 2px solid white; | ||
cursor: pointer; | ||
} | ||
|
||
|
||
/* JS Part - */ | ||
|
||
.show-overlay { | ||
visibility: visible; | ||
z-index: 9; | ||
} |