Skip to content

Instantly share code, notes, and snippets.

@ozknozsrt
Created February 18, 2018 11:00
Show Gist options
  • Save ozknozsrt/b3f5a5ddf809d8f84d9fe9cabf139a08 to your computer and use it in GitHub Desktop.
Save ozknozsrt/b3f5a5ddf809d8f84d9fe9cabf139a08 to your computer and use it in GitHub Desktop.
short code of smooth anchor scrolling
$(document).on('click', 'a[href^="#"]', function (event) {
event.preventDefault();
$('html, body').animate({
scrollTop: $($.attr(this, 'href')).offset().top
}, 500);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment