Skip to content

CamdenFoucht/smooth-scroller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

smooth-scroller

Smooth scrolling effect using Javascript

How to use

First import the scroll.js file into your HTML file

<script src="./scroll.js"></script>

Using the smoothScroller module, call scrollUp or scrollDown passing the id of the target element

<a href="#" onclick="smoothScroller.scrollUp('yourElementIdHere'); return false;"> Smooth scroll upwards </a>
<a href="#" onclick="smoothScroller.scrollDown('yourElementIdHere'); return false;"> Smooth scroll downwards </a>

Change the scroll settings by changing the speed or distance variable in scroll.js

var distance = 30;
var speed = 10;

Live example

https://s3-us-west-1.amazonaws.com/smooth-scroller/index.html

About

Smooth scrolling effect using Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published