Created
May 13, 2016 23:10
-
-
Save Krabaton/711196dcd46b90859d7d71c6e8440973 to your computer and use it in GitHub Desktop.
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[href^="#"]').on('click', function(e){ | |
e.preventDefault(); | |
var | |
$this = $(this), | |
target = $this.attr('href'), | |
strip = target.slice(1), | |
anchor = $("[id='"+ strip +"']"); | |
$('html, body').animate({ | |
scrollTop: anchor.offset().top | |
}, 2000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment