Lagging scroll with GSAP ScrollTrigger - React JS #366
Unanswered
Wylerlight
asked this question in
Q&A
Replies: 1 comment 2 replies
-
i had the same error. it turned out, that i had an error in my css. this css fixed it for me: html.lenis,
html.lenis body {
height: auto;
}
.lenis.lenis-smooth {
scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
overscroll-behavior: contain;
}
.lenis.lenis-stopped {
overflow: hidden;
}
.lenis.lenis-smooth iframe {
pointer-events: none;
} And i use this js code: import Lenis from "lenis";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { gsap } from "gsap";
gsap.registerPlugin(ScrollTrigger);
// [...]
const lenis = new Lenis({
duration: 2,
});
lenis.on("scroll", ScrollTrigger.update);
gsap.ticker.add((time) => {
lenis.raf(time * 1000);
});
gsap.ticker.lagSmoothing(0); i hope it helps. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
I'm messing around with Lenis and ScrollTrigger from GSAP. It seems like my screen is lagging when scrolling and I'm not quite sure how to fix it.
On other sites that utilizes Lenis scroll it's extremely smooth.
How do I alter my code to get it to scroll smooth along with animations and other CSS animations I plan to implement?
Example code below:
Beta Was this translation helpful? Give feedback.
All reactions