fix: show nav bar earlier

This commit is contained in:
2026-01-10 19:33:24 +00:00
parent 0a74d4eacd
commit 69ea77d236
7 changed files with 9 additions and 7 deletions

View File

@@ -136,6 +136,8 @@ const { version } = Astro.props;
if (!header || !hero) return;
// Show/hide header based on scroll past hero
// Show header when top half of hero is above the fold
const topMargin = Math.floor(window.innerHeight / 2);
const observer = new IntersectionObserver(
([entry]) => {
if (entry.isIntersecting) {
@@ -148,7 +150,7 @@ const { version } = Astro.props;
header.classList.add("dark:border-[var(--color-dark-border)]");
}
},
{ threshold: 0, rootMargin: "-64px 0px 0px 0px" }
{ threshold: 0, rootMargin: `-${topMargin}px 0px 0px 0px` }
);
observer.observe(hero);