Last active
December 29, 2015 17:59
-
-
Save pketh/7707387 to your computer and use it in GitHub Desktop.
using jquery and easing js, smooth scroll to a specific anchor links
This file contains 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
// 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