Created
June 5, 2015 16:44
-
-
Save VincentLoy/997719f71a6eef6bec5a to your computer and use it in GitHub Desktop.
scrollTo jQuery
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
$element.click(function (e) { | |
e.preventDefault(); | |
var page, | |
speed; | |
page = $(this).attr('href'); | |
speed = 750; | |
$('html, body').animate({ | |
scrollTop: $(page).offset().top | |
}, speed); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment