js scrollTop匀速滚动
//匀速滚动
function scroll(s,t){ let sp = 10/也可根据当前scrollTop动态改变sp的值,从而实现加速和减速滚动的效果 let cont = Number.parseInt(t / sp) let oneLong = s / cont let timer = setInterval(()=>{ console.log(cont) if(cont > 0){ cont-- window.scrollBy(0,oneLong) }else{ clearInterval(timer) } },sp) }