Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jQuery SmoothScroll
(function($, window) {
$(function() {
$('a[href^="#"]').click(
function() {
var nY = Math.min($($(this).attr("href")).offset().top, $(document).height() - $(window).height());
$('html,body').animate({ scrollTop:nY }, '1.3');
return false;
}
);
});
})(jQuery, window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.