Skip to content

Instantly share code, notes, and snippets.

@benbyford
Created May 8, 2013 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benbyford/5541580 to your computer and use it in GitHub Desktop.
Save benbyford/5541580 to your computer and use it in GitHub Desktop.
scroll to top - jquery
$('#top').click(function() {
var i = window.scrollY;
function scrollToTop() {
if(i > 0){
i = i - 10;
window.scrollTo(0, i);
setTimeout(scrollToTop, 10);
}
}
scrollToTop();
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment