Skip to content

Commit 5b7929a

Browse files
committed
fix(nav): show floating nav whenever scrolled past hero
Previous logic required scrolling UP past 80px to reveal the nav, which felt delayed. Show as soon as the user scrolls past the threshold in either direction.
1 parent ddb2b27 commit 5b7929a

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

components/site/floating-nav.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,7 @@ export function FloatingNav() {
2525
const [visible, setVisible] = useState(false);
2626

2727
useMotionValueEvent(scrollY, "change", (current) => {
28-
const previous = scrollY.getPrevious() ?? 0;
29-
if (current < 80) {
30-
setVisible(false);
31-
} else if (current < previous) {
32-
setVisible(true);
33-
} else {
34-
setVisible(false);
35-
}
28+
setVisible(current >= 80);
3629
});
3730

3831
return (

0 commit comments

Comments
 (0)