【前端】回到顶部

(function smoothscroll(){  
    var currentScroll = document.documentElement.scrollTop || document.body.scrollTop;  
    if (currentScroll > 0) {  
         window.requestAnimationFrame(smoothscroll);  
         window.scrollTo (0,currentScroll - (currentScroll/5));  
    }  
})();  
posted @ 2016-11-18 15:06  赵康  阅读(145)  评论(0编辑  收藏  举报