Skip to content

Instantly share code, notes, and snippets.

@Minobi
Last active September 3, 2020 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Minobi/fac46fe0b6711b82f9037ffb557cc75c to your computer and use it in GitHub Desktop.
Save Minobi/fac46fe0b6711b82f9037ffb557cc75c to your computer and use it in GitHub Desktop.
Smooth scroll to anchors on click with jQuery animate
$('a.page-scroll').on('click', event => {
event.preventDefault();
$('html, body').stop().animate({
scrollTop: $($(event.target).attr('href')).offset().top - 100
}, 1000, 'easeInOutExpo');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment