-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
26 lines (22 loc) · 761 Bytes
/
Copy pathmain.js
File metadata and controls
26 lines (22 loc) · 761 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
const modal = document.querySelector(".modal");
const openModalButton = document.querySelector(".open-modal-button");
const closeModalButton = document.querySelector(".close-modal");
const modalImage = document.querySelector(".modal-image");
let modalIsOpen;
modalIsOpen = false;
openModalButton.addEventListener("click", () => {
if (modalIsOpen)
modal.style.display = "none";
else
modal.style.display = "flex";
});
closeModalButton.addEventListener("click", () => {
modal.style.display = "none";
});
function resize_image() {
if (window.innerWidth / window.innerHeight < .7)
modalImage.src = "images/stack.jpg";
else
modalImage.src = "images/noa_4.png";
}
window.addEventListener("resize", resize_image);