Last active
March 28, 2019 20:11
-
-
Save KryptikOne/8059574 to your computer and use it in GitHub Desktop.
Smooth scrolling jump to links. Perfect for use on a single page site that needs smooth scrolling to each section. .anchor-element could be simply a list of links or a navigation area, just make sure the href of the link corresponds with the section's id.
This file contains hidden or 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
| $('.anchor-element').click(function(e){ | |
| e.preventDefault(); | |
| var jumpId = $(this).attr('href'); | |
| $('body, html').animate({scrollTop: $(jumpId).offset().top}, 'slow'); | |
| }); |
Awesome. Thanks for this
Amazing! Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Perfect.