Pure Vanilla JavaScript Smooth Scroll to Element on <a> anchor tag click #id
It took me half an hour and countless of stackoverflow pages to find a perfect solution for a smooth scroll for <a> anchor links.
So I'm adding here it as a snippet for future googlers.
document
.querySelectorAll('.nav__item a[href^="#"]')
...
blog.surjithctly.in2 min read
Mohith Gupta Korangi
A Better Person than Yesterday
But we have a CSS property for smooth-scroll, right?? Why not use it??