mirror of
https://github.com/jimeh/commonflow.org.git
synced 2026-02-19 05:46:40 +00:00
fix: show nav bar earlier
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user