smooth scroll in CSS code example
Example 1: smooth scroll css
html {
scroll-behavior: smooth;
}
http://iamdustan.com/smoothscroll/
Example 2: smooth scroll
$('a[href*=#]:not([href=#])').on('click', function() {
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 - 40)
}, 1000);
return false;
}
}
});
Example 3: smooth scroll website
$('#element').foundation('_destroy');