Skip to content

Instantly share code, notes, and snippets.

@TechWithTy
Created May 29, 2025 01:28
Show Gist options
  • Save TechWithTy/e06efb34040d71e7aea5275f57a3b5ca to your computer and use it in GitHub Desktop.
Save TechWithTy/e06efb34040d71e7aea5275f57a3b5ca to your computer and use it in GitHub Desktop.
let scrolling = true;
function scrollToBottom() {
const interval = setInterval(() => {
if (!scrolling) {
clearInterval(interval);
console.log('Scrolling stopped.');
return;
}
window.scrollBy(0, 50); // Scrolls down 50px
if ((window.innerHeight + window.scrollY) >= document.body.scrollHeight) {
clearInterval(interval);
console.log('Reached the bottom of the page.');
}
}, 50); // adjust speed as needed
}
function stopScroll() {
scrolling = false;
}
scrollToBottom();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment