Skip to content

Instantly share code, notes, and snippets.

@pketh
Last active December 29, 2015 17:59
Show Gist options
  • Save pketh/7707387 to your computer and use it in GitHub Desktop.
Save pketh/7707387 to your computer and use it in GitHub Desktop.
using jquery and easing js, smooth scroll to a specific anchor links
// smooth scroll to a specific section on the same page
function smoothScroll (selector) {
$('html, body').animate(
{
scrollTop: jQuery(selector).offset().top
},
600,
'easeOutCubic', // curves from http://easings.net/
function(){
$('#company').focus();
});
}
$(".sign-up-button").on('click', function(e) {
smoothScroll ('.section-sign-up'); // target destination div
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment