Sign in
Log inSign up
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?