Created
October 2, 2018 14:35
-
-
Save RiodeJaneiroo/d893e31ab1c224aed77dad888e0f8cc0 to your computer and use it in GitHub Desktop.
[Smooth Scroll to anchor] #js #scroll
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
$('a[href^="#"]').on('click', function(event) { | |
event.preventDefault(); | |
var sc = $(this).attr("href"), | |
dn = $(sc).offset().top; | |
$('html, body').animate({scrollTop: dn}, 1000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment