Skip to content

Instantly share code, notes, and snippets.

@jyokyoku
Created February 9, 2012 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jyokyoku/1781078 to your computer and use it in GitHub Desktop.
Save jyokyoku/1781078 to your computer and use it in GitHub Desktop.
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