Simple smooth, animated scroll thingamajiggy written in ES2015.
Basic usage
var simpleScroll = ; simpleScroll;
Installation
npm install simple-scroll
Features
- Scroll to an element with an optional offset
- Scroll to the bottom or the top off the page
- Scroll a set amount of pixels, viewport height, viewport width or percent
- Set up automatic usage for internal links
- Set the scroll duration and the min/max speed
Example usage
var simpleScroll = ; //Required element ID as the first parameter,//optionally an offset as the second parameter animated//optionally a third parameter for scroll durationsimpleScroll; //the first parameter (amount) is required, the second (duration) is optionalsimpleScroll; //scrolls 500 pixels down in 30 millisecondssimpleScroll; //scrolls 5 viewport height downsimpleScroll; //scrolls 5 viewport width upsimpleScroll; //scrolls 50% of the entire page down //the first parameter (duration) is optionalsimpleScroll; //scroll to the topsimpleScroll; //scroll to the bottom in 400 millisecondssimpleScroll; //sets up scrolling for internal links //Set the settings by passing in an objectsimpleScroll//These settings are the default settings
Todo
- Scroll timing functions (e.g. ease, linear, cubic-bezier etc)
If it is of interest, please feel free to contribute on Github
And yes, I am aware that there are better alternatives already out there. This is mostly my own learning.