Last active
September 3, 2020 08:13
-
-
Save Minobi/fac46fe0b6711b82f9037ffb557cc75c to your computer and use it in GitHub Desktop.
Smooth scroll to anchors on click with jQuery animate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('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