fixed dogshit scroll

This commit is contained in:
2026-02-06 15:48:40 +00:00
parent 6bc5d4b40b
commit 3c1df4a3b2

View File

@@ -13,6 +13,7 @@ const SPEED = 0.5; // px per frame
const PAUSE = 2000; // ms at top/bottom const PAUSE = 2000; // ms at top/bottom
let direction = 1; // 1 = down, -1 = up let direction = 1; // 1 = down, -1 = up
let scrollPos = 0;
let timeoutId; let timeoutId;
let timeoutId2; let timeoutId2;
@@ -27,7 +28,8 @@ function handleHover() {
function tick() { function tick() {
const el = container.value; const el = container.value;
el.scrollTop += SPEED * direction; scrollPos += SPEED * direction;
el.scrollTop = scrollPos;
const reachedBottom = el.scrollTop + el.clientHeight >= el.scrollHeight; const reachedBottom = el.scrollTop + el.clientHeight >= el.scrollHeight;
const reachedTop = el.scrollTop <= 0; const reachedTop = el.scrollTop <= 0;