Smooth Scroll Page When Clicking Anchor Link – jQuery


Add this to your jQuery file.

// Smooth scroll When Clicking Anchor
// @refer https://stackoverflow.com/a/7717572/8255629
var jQueryroot = $('html, body');
$('a[href^="#"]').click(function () {
  jQueryroot.animate({
    scrollTop: $( $.attr(this, 'href') ).offset().top
  }, 1000);
  return false;
});

Similar Posts