Skip to content

Instantly share code, notes, and snippets.

@TANVIRFAZLEY
Created January 11, 2018 23:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TANVIRFAZLEY/d46c46d97a9d38acb8d6ae50679ad314 to your computer and use it in GitHub Desktop.
Save TANVIRFAZLEY/d46c46d97a9d38acb8d6ae50679ad314 to your computer and use it in GitHub Desktop.
smooth scroll from IKAMAL
// Add smooth scrolling to all links
$('a[href^="#"]').on('click', function(e) {
e.preventDefault();
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