<button id="start">开 始</button>
<button id="stop">停 止</button>
<div style="overflow: hidden;">
<div id="content" style="overflow-y: scroll;">
<p>内容.....</p>
</div>
</div>
开始阅读
const start = document.getElementById('start')
const content = document.getElementById('content')
let time = null
start.onclick = function () {
time = setInterval(function () {
const getOld_top = content.scrollTop
content.scrollTop = getOld_top + 10
}, 1000)
}
结束阅读
stop.onclick = function () { clearInterval(time) }
滚动条自动移动
于 2023-09-27 15:43:20 首次发布