Skip to content

Instantly share code, notes, and snippets.

@ivanpepelko
Created October 4, 2016 12:47
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 ivanpepelko/480651695a8328c1ac69ad22b60415f4 to your computer and use it in GitHub Desktop.
Save ivanpepelko/480651695a8328c1ac69ad22b60415f4 to your computer and use it in GitHub Desktop.
javascript slow scroll
function slowscroll() {
this.current = pageYOffset;
if (this.current < scrollMaxY && this.to > this.current) {
window.scrollBy(0, 100);
setTimeout(slowscroll.bind(this), 1);
}
}
(slowscroll.bind({to:21352}))();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment