29 lines
701 B
JavaScript
29 lines
701 B
JavaScript
const scrollSpeed = 3;
|
||
const scrollDelay = 20;
|
||
|
||
let autoScrollInterval = null;
|
||
|
||
function startAutoScroll(){
|
||
if(autoScrollInterval) return;
|
||
|
||
autoScrollInterval = setInterval(() => {
|
||
window.scrollBy(0, scrollSpeed);
|
||
|
||
if ((window.innerHeight + window.scrollY) >= document.body.scrollHeight) {
|
||
/** Uncomment if you want to enable auto-stop on page end */
|
||
//stopAutoScroll();
|
||
//console.log("🙄 Reached bottom of page.");
|
||
}
|
||
}, scrollDelay);
|
||
|
||
console.log("💠🌐 Auto‑scroll engaged.");
|
||
}
|
||
|
||
function stopAutoScroll(){
|
||
clearInterval(autoScrollInterval);
|
||
autoScrollInterval = null;
|
||
console.log("💠🌐 Auto‑scroll disengaged.");
|
||
}
|
||
|
||
startAutoScroll();
|