Glide is a really simple scroll-to component written in vanilla JS. You can use it in vanilla JS or integrate it with jQuery.
npm install glide
Require it:
var Glide = require('glide');
Then call it:
new Glide(element, offset);
The offset is added to the top of the element and should just be numeric (e.g. 100).
Here is an example in jQuery that will take the href of each main nav link and go to that id in the DOM.
$(function(){
$('.main-nav a').on('click', function(e){
e.preventDefault();
var t = this.hash.replace('#', '');
new Glide(t, 130);
});
});
Glide is maintained by Piccirilli Dorsey