-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
32 lines (27 loc) · 850 Bytes
/
script.js
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
30
31
32
//Intersection observer
const textboxes = document.querySelectorAll(".textbox");
const tree = document.querySelector(".wrapper__container");
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
entry.target.classList.toggle(
"textbox--intersecting",
entry.isIntersecting
);
let textboxAtribute = entry.target.getAttribute("id");
tree.setAttribute("animation", textboxAtribute)
});
},
{
threshold: 1,
}
);
textboxes.forEach((textbox) => {
observer.observe(textbox);
});
// orientation button
const orientationButton = document.querySelector(".orientation__message--button");
const orientationContainer = document.querySelector("#landscape__message--container");
orientationButton.addEventListener("click", () => {
orientationContainer.remove();
})