-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
20 lines (18 loc) · 726 Bytes
/
Copy pathscript.js
File metadata and controls
20 lines (18 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Scroll reveal
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
}
});
}, { threshold: 0.1, rootMargin: '0px 0px -40px 0px' });
document.querySelectorAll('.reveal').forEach(el => observer.observe(el));
// Nav shrink on scroll
const nav = document.querySelector('nav');
window.addEventListener('scroll', () => {
if (window.scrollY > 80) {
nav.style.padding = '1rem 3rem';
} else {
nav.style.padding = '1.4rem 3rem';
}
});