// JavaScript Document function goTopEx(){ var obj=document.getElementById("goTopBtn"); function getScrollTop(){ return document.documentElement.scrollTop; } function setScrollTop(value){ document.documentElement.scrollTop=value; } window.onscroll=function(){getScrollTop()>0?obj.style.display="":obj.style.display="none";} obj.onclick=function(){ var goTop=setInterval(scrollMove,10); function scrollMove(){ setScrollTop(getScrollTop()/1.1); if(getScrollTop()<1)clearInterval(goTop); } } }
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/10058.html