Skip to content

Instantly share code, notes, and snippets.

@Takaya213
Created May 2, 2013 07:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Takaya213/5500780 to your computer and use it in GitHub Desktop.
Save Takaya213/5500780 to your computer and use it in GitHub Desktop.
An easy way to create a scroll effect on pages from one anchor to another.
$(document).ready(function(){
$('a').click(function(){
$('html, body').animate({
scrollTop: $( $.attr(this, 'href') ).offset().top
}, 500);
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment