My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
How to do smooth scrolling without jQuery?

How to do smooth scrolling without jQuery?

Stephan de Vries's photo
Stephan de Vries
·Mar 17, 2016

In the past when I wanted to have smooth scrolling on a website I'd just use this jQuery snippet by CSS-Tricks. It does exactly what I want and didn't require any javascript library (except jQuery).

These days I prefer to avoid using big libraries like jQuery too much, because I only use 5% of the functionalities while getting worse load times. Causing me to look for a vanilla JS version of the jQuery snippet provided by CSS-Tricks.

Is there an elegant way of implementing smooth scrolling by using vanilla JS?