Huy Guys, it happend to you when you couldn’t scroll the website after clicking the load more button
No console error and everything looks fine
I’m using lenis scroll on that website
Huy Guys, it happend to you when you couldn’t scroll the website after clicking the load more button
No console error and everything looks fine
I’m using lenis scroll on that website
Hello @elay! You’ll need to reinitiate Lenis after new items have been rendered.
The code should look something like this
<script>
window.fsAttributes = window.fsAttributes || [];
window.fsAttributes.push([
'cmsload',
(listInstances) => {
console.log('cmsload Successfully loaded!');
const [listInstance] = listInstances;
const lenisConfig = {
// Your Lenis configuration
};
let lenis = new Lenis(lenisConfig);
// Start Lenis scroll
function raf(time) {
lenis.raf(time);
requestAnimationFrame(raf);
}
requestAnimationFrame(raf);
listInstance.on('renderitems', (renderedItems) => {
console.log(renderedItems);
if (lenis) {
lenis.destroy(); // Destroy the existing instance
}
lenis = new Lenis(lenisConfig); // Reinitialize with the same configuration
requestAnimationFrame(raf); // Restart the scroll animation
});
},
]);
</script>
Please test it out and let me know how it goes! If you need help please share a link and I’ll help you out!