Skip to content

Instantly share code, notes, and snippets.

@sshkarupa
Last active August 29, 2015 14:17
Show Gist options
  • Save sshkarupa/5a93ba41cfd07b381fd9 to your computer and use it in GitHub Desktop.
Save sshkarupa/5a93ba41cfd07b381fd9 to your computer and use it in GitHub Desktop.
smooth scroll function
//smooth scroll function
$('a[href^="#"]').click(function () {
elementClick = $(this).attr("href");
destination = $(elementClick).offset().top;
$('html,body').animate( { scrollTop: destination }, 1000 );
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment