Created
March 20, 2014 19:52
-
-
Save j0lvera/9672386 to your computer and use it in GitHub Desktop.
jQuery Smooth Scrool
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
var smoothScroll = function(id) { | |
var target = $(id).offset().top - 60; | |
$('html, body').animate({scrollTop:target}, 500); | |
}; | |
/* | |
* Use | |
*/ | |
$('a#link').on('click', function(e) { | |
e.preventDefault(); | |
smoothScroll('#target'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment