缓慢回滚置顶动画效果
this.toTop = () =>{
let timer = null;
cancelAnimationFrame(timer);
timer = requestAnimationFrame(function fn(){
let oTop = document.body.scrollTop || document.documentElement.scrollTop;
if(oTop > 0){
document.body.scrollTop = document.documentElement.scrollTop = oTop - 100;
timer = requestAnimationFrame(fn);
}else{
cancelAnimationFrame(timer);
}
});
};