-
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) · 728 Bytes
/
script.js
File metadata and controls
29 lines (25 loc) · 728 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
document.body.classList.add("reveal-ready");
const revealItems = document.querySelectorAll("[data-reveal]");
if (!("IntersectionObserver" in window)) {
revealItems.forEach((item) => item.classList.add("is-visible"));
} else {
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (!entry.isIntersecting) {
return;
}
entry.target.classList.add("is-visible");
observer.unobserve(entry.target);
});
},
{
threshold: 0.18,
rootMargin: "0px 0px -10% 0px",
},
);
revealItems.forEach((item, index) => {
item.style.transitionDelay = `${Math.min(index * 70, 360)}ms`;
observer.observe(item);
});
}