diff --git a/bundled/lenis.js b/bundled/lenis.js index 7bd6b7f8..60fac151 100644 --- a/bundled/lenis.js +++ b/bundled/lenis.js @@ -720,7 +720,7 @@ _createClass(Lenis, [{ key: "rootElement", get: function get() { - return this.options.wrapper === window ? this.options.content : this.options.wrapper; + return this.options.wrapper === window ? document.documentElement : this.options.wrapper; } }, { key: "limit", diff --git a/src/index.js b/src/index.js index 9fb2501e..840ad861 100644 --- a/src/index.js +++ b/src/index.js @@ -399,7 +399,7 @@ export default class Lenis { get rootElement() { return this.options.wrapper === window - ? this.options.content + ? document.documentElement : this.options.wrapper } diff --git a/website/pages/docs/index.js b/website/pages/docs/index.js index afd3d362..12e030f4 100644 --- a/website/pages/docs/index.js +++ b/website/pages/docs/index.js @@ -35,10 +35,15 @@ export default function Docs() { }, []) useEffect(() => { - lenis?.on('scroll', (e) => { - console.log(e.scroll, e.limit, e.progress) + rootLenis?.on('scroll', (e) => { + console.log( + window.scrollY, + e.scroll, + Math.floor(e.scroll), + e.actualScroll + ) }) - }, [lenis]) + }, [rootLenis]) useFrame((time) => { rootLenis?.raf(time)