darkroomengineering / lenis

How smooth scroll should be
https://lenis.darkroom.engineering
MIT License
7.35k stars 315 forks source link

Scroll top problem only on IOS #288

Closed atoupet-toki closed 3 months ago

atoupet-toki commented 5 months ago

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?

clementroche commented 5 months ago

smoothTouch has been removed from Lenis, please use syncTouch instead

atoupet-toki commented 5 months ago

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

clementroche commented 5 months ago

What version of lenis do you use ?

atoupet-toki commented 5 months ago

1.0.34

clementroche commented 5 months ago

Would you mind sharing a codepen/codesandbox ?

cyocun commented 4 months ago

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.

clementroche commented 3 months ago

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

Slgoetz commented 4 weeks ago

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

immiProgrammer commented 4 weeks ago

i fase this problem

clementroche commented 4 weeks ago

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()/