Skip to content

Instantly share code, notes, and snippets.

@vickyRathee
Created May 1, 2020 12:54
Show Gist options
  • Save vickyRathee/7ecdeefe322b0196648b6d0475a68eb9 to your computer and use it in GitHub Desktop.
Save vickyRathee/7ecdeefe322b0196648b6d0475a68eb9 to your computer and use it in GitHub Desktop.
var totalHeight = 0;
var distance = 100;
var timer = setInterval(() => {
var scrollHeight = document.body.scrollHeight;
window.scrollBy(0, distance);
totalHeight += distance;
if (totalHeight >= scrollHeight) {
clearInterval(timer);
}
}, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment