Created
May 29, 2025 01:28
-
-
Save TechWithTy/e06efb34040d71e7aea5275f57a3b5ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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