Skip to content

samuelrai/smoothscroll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Very simple JavaScript smooth scroll

Using vanilla JS, this is a very simple JavaScript smooth scroll script with ease in and out.

How to use?

  1. Add <script src="smoothscroll.js"></script> inside the body tag.
  2. Add a preferred id="example" to an element you'd like to scroll to.
  3. Add data-scrollto="example" to an element you'd like to scroll from. For example, this could be <a data-scrollto="example">Link</a> but you can link from other elements like span, div, or img too.
  4. Ta-da!

Was this helpful?

If you are a really nice person, buy me a coffee.