【前端】回到顶部

(function smoothscroll(){  
    var currentScroll = document.documentElement.scrollTop || document.body.scrollTop;  
    if (currentScroll > 0) {  
         window.requestAnimationFrame(smoothscroll);  
         window.scrollTo (0,currentScroll - (currentScroll/5));  
    }  
})();  
原文地址:https://www.cnblogs.com/forzhaokang/p/6077793.html