Created
March 23, 2016 15:14
-
-
Save iamjoshellis/d88aecc95b5400fd2ead to your computer and use it in GitHub Desktop.
Scroll to a thing based on the href attribute of another thing
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
$("a").click(function(e){ | |
e.preventDefault(); | |
var target = $(this).attr('href'); | |
$('html, body').animate({ | |
scrollTop: $(target).offset().top | |
}, 1000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment