Repository navigation
|
I don't seem to have Overscroll working when using Lenis. Here are the settings I have: autoRaf: true,
autoToggle: true,
anchors: true,
allowNestedScroll: true,
naiveDimensions: true,
stopInertiaOnNavigate: true,I have even tried to disable them all one by one and it does not seem to change. Removing There seem to be an Just to be clear, what I understand as In other cases I wouldn't mind, but in this case it is not for cosmetic. I am willing to use this to implement automatic navigation when scrolling past the bottom a certain amount. At current state of my thinking, it sounds simpler to rely on Overscroll rather than building this interaction from scratch. But I may be wrong. Anybody knows why I cannot get Overscroll working? |
Replies: 1 comment 1 reply
|
Lenis's For auto-navigation, you can listen to const lenis = new Lenis({ autoRaf: true })
let pull = 0
lenis.on('virtual-scroll', ({ deltaY }) => {
const atBottom = lenis.limit - lenis.scroll < 1
if (atBottom && deltaY > 0) {
pull += deltaY
if (pull > 400) { pull = 0; goToNextPage() }
} else {
pull = 0
}
})I tested this in Chromium with lenis 1.3.26. The scroll stopped exactly at |
Lenis's
overscrolloption isn't a bounce effect. It works like CSSoverscroll-behavior: it only decides whether a nested Lenis instance (one whosewrapperisn'twindow) passes the scroll on to its parent when it reaches an edge (lenis.ts L558-L570). On the page itself,scrollToclamps the target to[0, limit](L854), so it can never scroll past the bottom and spring back.For auto-navigation, you can listen to
virtual-scroll. It keeps firing at the edge, so you can add up how far the user keeps pulling: