Skip to content

Instantly share code, notes, and snippets.

Created Apr 8, 2018
What would you like to do?
jQuery smooth scroll to # links
$(document).ready(function() {
$("a[href^='#']").on("click", function(event) {
var target = this.hash,
$target = $(target);
$("html, body").stop().animate({
"scrollTop": $target.offset().top
}, 900, "swing", function() {
window.location.hash = target;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment