Last active
April 17, 2020 08:28
-
-
Save koyanloshe/1c9330f40b8ecdc215d6c7b78420a5ce to your computer and use it in GitHub Desktop.
smoothScroll.js #Javascript #jQuery
This file contains hidden or 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").on('click', function (event) { | |
if (this.hash !== "") { | |
event.preventDefault(); | |
var hash = this.hash; | |
$('html, body').animate({ | |
scrollTop: $(hash).offset().top | |
}, 800, function () { | |
window.location.hash = hash; | |
}); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment