-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c35080a
commit ec3cc4b
Showing
2 changed files
with
21 additions
and
22 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 |
---|---|---|
@@ -1,25 +1,17 @@ | ||
// Get the modal | ||
var modal = document.getElementById("myModal"); | ||
// const modal = document.getElementById("myModal"); | ||
// const btn = document.getElementById("myBtn"); | ||
// const span = document.getElementsByClassName("close")[0]; | ||
|
||
// Get the button that opens the modal | ||
var btn = document.getElementById("myBtn"); | ||
// btn.onclick = function () { | ||
// modal.style.display = "block"; | ||
// }; | ||
|
||
// Get the <span> element that closes the modal | ||
var span = document.getElementsByClassName("close")[0]; | ||
// span.onclick = function () { | ||
// modal.style.display = "none"; | ||
// }; | ||
|
||
// When the user clicks the button, open the modal | ||
btn.onclick = function () { | ||
modal.style.display = "block"; | ||
}; | ||
|
||
// When the user clicks on <span> (x), close the modal | ||
span.onclick = function () { | ||
modal.style.display = "none"; | ||
}; | ||
|
||
// When the user clicks anywhere outside of the modal, close it | ||
window.onclick = function (event) { | ||
if (event.target == modal) { | ||
modal.style.display = "none"; | ||
} | ||
}; | ||
// window.onclick = function (event) { | ||
// if (event.target == modal) { | ||
// modal.style.display = "none"; | ||
// } | ||
// }; |
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