-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (23 loc) · 788 Bytes
/
Copy pathscript.js
File metadata and controls
29 lines (23 loc) · 788 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
/* Member reveal */
const members = document.querySelectorAll(".member");
const observer = new IntersectionObserver(
entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("show");
}
});
},
{ threshold: 0.45 }
);
members.forEach(member => observer.observe(member));
/* Subtle background convergence without gaps */
const yellowBg = document.querySelector(".bg-yellow");
const blackBg = document.querySelector(".bg-black");
window.addEventListener("scroll", () => {
const scrollY = window.scrollY;
/* Yellow reduces */
yellowBg.style.transform = `translateY(${-scrollY * 0.01}px)`;
/* Black increases */
blackBg.style.transform = `translateY(${-scrollY * 0.06}px)`;
});