-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (25 loc) · 853 Bytes
/
Copy pathscript.js
File metadata and controls
29 lines (25 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Code for Dismissibile Alerts
const dismissBtns = document.querySelectorAll(".alert__dismiss-btn");
dismissBtns.forEach((btn) => {
btn.addEventListener("click", () => {
btn.parentElement.remove();
});
});
// Code for Modals
const overlay = document.querySelector(".overlay");
const modalAction = document.querySelectorAll(".modal__action");
const modal = document.querySelectorAll(".modal");
const openSimpleModal = document.querySelector(".open-simple-modal");
const simpleModal = document.querySelector(".simple-modal");
openSimpleModal.addEventListener("click", () => {
simpleModal.classList.remove("hide");
overlay.classList.remove("hide");
});
modalAction.forEach((btn) => {
btn.addEventListener("click", () => {
overlay.classList.add("hide");
modal.forEach((ele) => {
ele.classList.add("hide");
});
});
});