Skip to content

Instantly share code, notes, and snippets.

@cngodles
Created May 21, 2021 13:41
Show Gist options
  • Save cngodles/54cac97c5dbf43998a0734e21c2ff6ac to your computer and use it in GitHub Desktop.
Save cngodles/54cac97c5dbf43998a0734e21c2ff6ac to your computer and use it in GitHub Desktop.
Auto scroll Example
$(document)
.on("click", 'a[href^="#"]', function(e){
e.preventDefault();
var target = $(this).attr("href");
$('html, body').animate({scrollTop: $(target).offset().top }, 400);
})
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment