I use lenis.js for smooth scrolling which works well.
While creating landing pages When I click on the menu, I implemented it to go to each other section.
But, scroll event doesn’t work because of lenis.js.(maybe)
If you know how to solve it, please answer me!!! ????????????????????????
I applied a smooth scrolling effect using lenis.js. But using lenis.js, scroll event causes error. When I click on the menu, I made it go to the appropriate section, but it’s not working properly because of lenis.js. I’m not sure what other good options are available
I’m sorry for my lack of English
thank u
HTML:
<ul class="menu">
<li>
<a href="javascript:" rel="section01">menu1</a>
</li>
<li>
<a href="javascript:" rel="section02">menu2</a>
</li>
<li>
<a href="javascript:" rel="section03">menu3</a>
</li>
</ul>
$(".menu li a").on("click", function (event) {
event.preventDefault();
let targetContent = $(this).attr("rel");
let offset = $("#" + targetContent).offset().top;
$("html, body").animate({ scrollTop: offset }, 1000);
});
I applied a smooth scrolling effect using lenis.js. But using lenis.js, scroll event causes error. When I click on the menu, I made it go to the appropriate section, but it’s not working properly because of lenis.js. I’m not sure what other good options are available
DaSeul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.