First. We can scroll to an element!
smoothScroll(myElement);
If you pass no parameters, you scroll to the top
smoothScroll();
Notice the extra space above? That is the offset!
SimpleSmoothScroll also factors in the bottom of the page to make sure we are always easing
smoothScroll(footer);
Lastly, we can add custom easing functions. These are used when you want to get to your element in a different fashion from ease-in-out. Below is an example of a linear easing function
smoothScroll(myElement, {
getEasingFunction: function(targetPosition) {
return function(stepCount) {
return stepCount * 0.01;
}
}
});