Smooth Scrolling

Code for smooth scrolling with JavaScript

Will KimNovember 17, 2021

Code 💻

Very simple way to achieve smooth scrolling:

<a
  onClick="document.querySelector('.contact-form').scrollIntoView({ behavior: 'smooth' });"
>
</a>

Just by adding .scrollIntoView({ behavior: 'smooth' }) creates a smooth auto scroll to the element.

Invely's