What's the best way to implement js scroll to element smoothly? or How can I use js scroll to element

14 Replies, 652 Views

"Best way to implement js scroll to element smoothly?"

Hey folks!

I’ve been trying to get a smooth js scroll to element working on my site, but it either jumps or feels clunky.

I’ve tried `window.scrollTo()` with behavior: 'smooth', but it’s not consistent across browsers.

Any tips for a modern, reliable approach?

Also, is there a way to add custom easing or animations? Or am I stuck with the default smooth scroll?

Thanks in advance!

---

*P.S. If you’ve got a vanilla JS solution, even better. Trying to avoid libraries if possible.*

Messages In This Thread
What's the best way to implement js scroll to element smoothly? or How can I use js scroll to element - by - 27-11-2024, 11:04 PM



Users browsing this thread: 1 Guest(s)