darkroomengineering / lenis

How smooth scroll should be

Home Page:https://lenis.darkroom.engineering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scroll top problem only on IOS

atoupet-toki opened this issue · comments

Hello!
We have a scroll top problem only on IOS (safari/chrome).
When the page loads, we scroll a little and HOP the site scrolls up completely, and then everything works correctly again.
Our new/future database contains GSAP/SWUP/Lenis.

Here's some of the code used to init lenis, and the associated scss:

window.lenis = new Lenis({
    smoothWheel: true,
    smoothTouch: false,
    duration: 1.1,
    easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
});
window.lenis.on('scroll', () => {
    ScrollTrigger.update;
});
gsap.ticker.add((time) => {
    window.lenis.raf(time * 1000);
});
html.lenis {
    height: auto;

    &.lenis-smooth {
        scroll-behavior: auto;
    }
    &.lenis-smooth [data-lenis-prevent] {
        overscroll-behavior: contain;
    }
    &.lenis-stopped {
        overflow: hidden;
    }
    &.lenis-scrolling iframe {
        pointer-events: none;
    }
}

Have you ever had a similar problem?

smoothTouch has been removed from Lenis, please use syncTouch instead

Thanks for your quick feedback!
It doesn't seem to work ... but I managed with the following js: ScrollTrigger.config({ ignoreMobileResize: true });

What version of lenis do you use ?

1.0.34

Would you mind sharing a codepen/codesandbox ?

I'm also having the same problem.

If you scroll the window a little and speak, you will be scrolled back to the beginning of the page.
If you scroll a lot (maybe a screen or two), you'll be able to scroll normally from then on.

And I am also using ScrollTrigger within the page. I am unable to provide sample code immediately.
ScrollTrigger.config({ ignoreMobileResize: true });
I would like to try this.

I'm closing this issue until you provide a minimal reproduction link.

I am seeing the same issue on "lenis": "^1.1.1"

commented

i fase this problem

Your issue might be caused by Scrolltriger itself, not Lenis, try to remove ScrollTrigger and see if it still happens. If so take a look at this https://gsap.com/docs/v3/Plugins/ScrollTrigger/static.clearScrollMemory()/