<!DOCTYPE html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<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 发布