diff --git a/package.json b/package.json index 8e35c292..e6695eac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lenis", - "version": "1.1.19-dev.3", + "version": "1.1.19-dev.4", "description": "How smooth scroll should be", "type": "module", "sideEffects": false, diff --git a/packages/core/src/lenis.ts b/packages/core/src/lenis.ts index 90ecc8b7..be78b838 100644 --- a/packages/core/src/lenis.ts +++ b/packages/core/src/lenis.ts @@ -747,9 +747,12 @@ export class Lenis { */ get actualScroll() { // value browser takes into account + // it has to be this way because of DOCTYPE declaration + const wrapper = this.options.wrapper as Window | HTMLElement + return this.isHorizontal - ? this.rootElement.scrollLeft - : this.rootElement.scrollTop + ? (wrapper as Window).scrollX ?? (wrapper as HTMLElement).scrollLeft + : (wrapper as Window).scrollY ?? (wrapper as HTMLElement).scrollTop } /** diff --git a/playground/core/static.html b/playground/core/static.html new file mode 100644 index 00000000..30c50805 --- /dev/null +++ b/playground/core/static.html @@ -0,0 +1,22 @@ + +
+ + + + + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Inventore aliquid + aliquam quam officiis hic ut voluptatibus dicta perferendis, voluptate iure + modi iste ratione explicabo architecto impedit ipsa. Blanditiis, tenetur + itaque. + +