//Smooth scroll for anchors
$('a[href*="#"]:not([href="#"])').click(function() {
var offset = -20; // <-- change the value here
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top + offset
}, 500);
return false;
}
}
});
Tuesday, April 3, 2018
Add smooth scroll to all anchors links
Just use the following js:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment