Is there a reason why the scroll-behavior: smooth property doesn't function properly when Lenis library for smooth scrolling is included? It seems to work fine when the Lenis code is commented out, but once it's added back in, the scrolling isn't as smooth when clicking on the tag with the specified ID.
const lenis = new Lenis({
duration: 2.5
})
function raf(time) {
lenis.raf(time)
requestAnimationFrame(raf)
}
requestAnimationFrame(raf)
lenis.on('scroll', ScrollTrigger.update)
gsap.ticker.add((time) => {
lenis.raf(time * 1000)
})
html {
scroll-behavior: smooth;
}
<h2><a class="c-btn" href="#pages-main">scroll down</a></h2>
<section id="pages-main"></section>
Is there a reason why the scroll-behavior: smooth property doesn't function properly when Lenis library for smooth scrolling is included? It seems to work fine when the Lenis code is commented out, but once it's added back in, the scrolling isn't as smooth when clicking on the tag with the specified ID.
const lenis = new Lenis({
duration: 2.5
})
function raf(time) {
lenis.raf(time)
requestAnimationFrame(raf)
}
requestAnimationFrame(raf)
lenis.on('scroll', ScrollTrigger.update)
gsap.ticker.add((time) => {
lenis.raf(time * 1000)
})
html {
scroll-behavior: smooth;
}
<h2><a class="c-btn" href="#pages-main">scroll down</a></h2>
<section id="pages-main"></section>