This commit is contained in:
2025-12-25 23:58:53 +01:00
parent fb793e0cb6
commit 6888cd107a
9 changed files with 277 additions and 19 deletions

View File

@@ -16,10 +16,15 @@ document.addEventListener('DOMContentLoaded', () => {
});
// Header shrink on scroll
let ticking = false;
const onScroll = () => {
if (!header) return;
const shouldShrink = window.scrollY > 40;
header.classList.toggle('is-scrolled', shouldShrink);
if (ticking || !header) return;
ticking = true;
window.requestAnimationFrame(() => {
const shouldShrink = window.scrollY > 120;
header.classList.toggle('is-scrolled', shouldShrink);
ticking = false;
});
};
onScroll();
window.addEventListener('scroll', onScroll, { passive: true });