网页自动上下滚动
let scrollDir = 100; setInterval(() => { const isBottom = window.innerHeight +
window.scrollY >= document.documentElement.scrollHeight; const isTop =
window.scrollY <= 0; if (isBottom) { scrollDir = -scrollDir; } else if (isTop &&
scrollDir < 0) { scrollDir = Math.abs(scrollDir); } window.scrollBy(0,
scrollDir); }, 1000);