-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
completed the Modal Animation Project
- Loading branch information
Showing
5 changed files
with
151 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,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<link rel="stylesheet" href="./style.css" /> | ||
<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>Modal</title> | ||
</head> | ||
<body> | ||
<div class="backdrop display"></div> | ||
<h1>Modal Animation</h1> | ||
<button class="btn Close_btn_function" id="btn">Open Modal</button> | ||
<div class="modal display"> | ||
This is the Sample Modal Message | ||
<div>Click on Buttons or Outside of the modal to close</div> | ||
<div> | ||
<button class="btn__close Close_btn_function">Close</button> | ||
<button class="btn__ok Close_btn_function">Ok</button> | ||
</div> | ||
</div> | ||
<footer> | ||
<div>Credit: <a href="https://github.com/pulkit-30">PULKIT GUPTA</a></div> | ||
<div>Date: 1 /08/ 2020</div> | ||
</footer> | ||
</body> | ||
<script src="./script.js"></script> | ||
</html> |
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,3 @@ | ||
# Modal Box Animation | ||
|
||
<img src="./pro.png"/> |
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,13 @@ | ||
const btn = document.querySelectorAll(".Close_btn_function"); | ||
const Modal = document.querySelector(".modal"); | ||
const body = document.querySelector("body"); | ||
const Backdrop = document.querySelector(".backdrop"); | ||
const Close = () => { | ||
Modal.classList.toggle("display"); | ||
Backdrop.classList.toggle("display"); | ||
body.classList.toggle("body__active__modal"); | ||
}; | ||
btn.forEach((Element) => { | ||
Element.addEventListener("click", Close); | ||
}); | ||
Backdrop.addEventListener("click", Close); |
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,107 @@ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
body { | ||
background-color: #2c2e43; | ||
font-family: sans-serif; | ||
color: white; | ||
display: flex; | ||
height: 100vh; | ||
width: 100%; | ||
flex-direction: column; | ||
justify-content: space-evenly; | ||
align-items: center; | ||
letter-spacing: 5px; | ||
} | ||
h1 { | ||
font-size: 50px; | ||
} | ||
.btn { | ||
width: 300px; | ||
height: 40px; | ||
background-color: #b2b1b9; | ||
font-size: 20px; | ||
border-radius: 3px; | ||
-webkit-border-radius: 3px; | ||
-moz-border-radius: 3px; | ||
-ms-border-radius: 3px; | ||
-o-border-radius: 3px; | ||
cursor: pointer; | ||
transition: 0.5s; | ||
-webkit-transition: 0.5s; | ||
-moz-transition: 0.5s; | ||
-ms-transition: 0.5s; | ||
-o-transition: 0.5s; | ||
box-shadow: 0px 0px 5px black; | ||
border: 2px solid white; | ||
} | ||
.btn:hover { | ||
transform: scale(1.2); | ||
-webkit-transform: scale(1.2); | ||
-moz-transform: scale(1.2); | ||
-ms-transform: scale(1.2); | ||
-o-transform: scale(1.2); | ||
} | ||
.backdrop { | ||
background-color: rgba(0, 0, 0, 0.747); | ||
position: fixed; | ||
top: 0; | ||
right: 0; | ||
height: 100vh; | ||
width: 100%; | ||
z-index: 10; | ||
} | ||
|
||
.modal { | ||
position: fixed; | ||
top: 30%; | ||
right: 25%; | ||
width: 50%; | ||
height: 20rem; | ||
background-color: #787a91; | ||
border-radius: 5px; | ||
-webkit-border-radius: 5px; | ||
-moz-border-radius: 5px; | ||
-ms-border-radius: 5px; | ||
-o-border-radius: 5px; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-evenly; | ||
align-items: center; | ||
box-shadow: 0px 0px 10px black; | ||
z-index: 100; | ||
} | ||
.btn__ok { | ||
width: 200px; | ||
height: 3rem; | ||
font-size: 20px; | ||
border-radius: 4px; | ||
-webkit-border-radius: 4px; | ||
-moz-border-radius: 4px; | ||
-ms-border-radius: 4px; | ||
-o-border-radius: 4px; | ||
cursor: pointer; | ||
} | ||
.btn__close { | ||
font-size: 20px; | ||
width: 200px; | ||
height: 2rem; | ||
background: none; | ||
border: none; | ||
color: white; | ||
cursor: pointer; | ||
} | ||
.display { | ||
display: none; | ||
} | ||
.body__active__modal { | ||
height: 100vh; | ||
overflow: hidden; | ||
} | ||
footer { | ||
position: absolute; | ||
bottom: 5px; | ||
left: 5px; | ||
color: white; | ||
} |