Skip to content

Instantly share code, notes, and snippets.

@chapmanjacobd
Last active September 20, 2023 02:32
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 chapmanjacobd/aef3649fc23e468dd9f338470e3d194f to your computer and use it in GitHub Desktop.
Save chapmanjacobd/aef3649fc23e468dd9f338470e3d194f to your computer and use it in GitHub Desktop.
javascript:(function(){
var previousScroll;
var scrollInterval;
var nextPageTimeout;
function scrollAndCheck() {
previousScroll = window.scrollY;
window.scrollBy(0, 3000);
var currentScroll = window.scrollY;
var maxScroll = document.body.scrollHeight - window.innerHeight;
clearTimeout(nextPageTimeout);
nextPageTimeout = setTimeout(function () {
if (currentScroll + 10 >= maxScroll && previousScroll == currentScroll) {
clearInterval(scrollInterval);
}
}, 10000);
}
scrollInterval = setInterval(scrollAndCheck, 1200);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment