const myScroll = (isDown) => {
// const pageDom = 你要滚动的dom
// 滚动步长
const step = 20
// 滚动时间间隔
const timeStep = 15
// 单次滚动的间隔移动的持续时间
const continueTime = 150
const gaper = setInterval(() => {
let distinceToTop = pageDom.scrollTop
isDown ? distinceToTop += step : distinceToTop -= step
pageDom.scrollTo(0, distinceToTop)
}, timeStep)
let stopIntervalTimer = setTimeout(() => {
clearInterval(gaper)
}, continueTime)
// this.stopIntervalTimerArray.push(stopIntervalTimer)
// console.log("==1", this.stopIntervalTimerArray)
}
scrollContainer = () => {
hotTableDiv.addEventListener('wheel', (e) => {
var e = e || window.event;
this.myScroll(e.wheelDelta < 0)
}
})
}
手写鼠标滚动(待完善
最新推荐文章于 2024-09-04 20:18:34 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)