首页 > 其他 > 详细

scrolltop

时间:2014-10-09 16:27:28      阅读:298      评论:0      收藏:0      [点我收藏+]
<script>
lastScrollY=0;
function heartBeat(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{/*Netscape stuff*/}
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.getElementById("full").style.top=parseInt(document.getElementById("full").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
}
suspendcode="<div id=\"full\" style=‘right:15px;POSITION:absolute;TOP:600px;z-index:100; cursor:pointer;‘><a onclick=‘window.scrollTo(0,0);‘ ><img src=‘./lib/tpl/vector/totop.gif‘></a><br></div>"
document.write(suspendcode);
window.setInterval("heartBeat()",1);
</script>

 

scrolltop

原文:http://www.cnblogs.com/gordensong/p/4013479.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!