-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
19 lines (17 loc) · 823 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// select modal-btn,modal-overlay,close-btn X
// listen for click events on modal-btn and close-btn X
// when user clicks modal-btn add .open-modal to modal-overlay X
// when user clicks close-btn remove .open-modal from modal-overlay X
// select modal-btn, modal-overlay, close-btn
const modalBtn = document.querySelector(".modal-btn")
const modal = document.querySelector(".modal-overlay")
const closeBtn = document.querySelector(".close-btn")
// listen for click events on modal-btn and close-btn
modalBtn.addEventListener("click", function () {
// when user clicks modal-btn add .open-modal to modal-overlay
modal.classList.add("open-modal")
})
closeBtn.addEventListener("click", function () {
// when user clicks close-btn remove .open-modal from modal-overlay
modal.classList.remove("open-modal")
})