<html >
<head>
</head>
<body>
<div style="width:100px;height:100px;position:absolute;right:20px;top:80px;background:#FFCC00;border:1px solid #999;"></div>
<script type="text/javascript">
<!--
var i=0, str="";while(i++<100){str+="<br>"}
document.write(str);
var div = document.getElementsByTagName("div")[0];
var y = parseInt(div.style.top);
setInterval(function(){
var cy = parseInt(div.style.top);
var dy = document.body.scrollTop || document.documentElement.scrollTop;
div.style.top = (cy + (dy -(cy-y))*0.1) + "px";
},10);
//-->
</script>
</body>
</html>
div随滚动条移动
最新推荐文章于 2022-08-25 14:49:11 发布