<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
#div1 {width:100px; height:150px; background:red; position:absolute; right:0; bottom:0;}
</style>
<script> window.onscroll=function()
{
var oDiv=document.getElementById('div1'); var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;
//alert(document.documentElement.clientHeight);
//oDiv.style.top=document.documentElement.clientHeight-oDiv.offsetHeight+scrollTop+'px';
//alert(document.documentElement.clientHeight);
//document.title=oDiv.offsetHeight;
//alert(oDiv.offsetHeight);
//alert(document.documentElement.scrollTop);
//alert(scrollTop);
//alert(document.documentElement.clientHeight-oDiv.offsetHeight+scrollTop);
startMove(document.documentElement.clientHeight-oDiv.offsetHeight+scrollTop);
} var timer=null;
function startMove(iTarget)
{
var oDiv=document.getElementById('div1'); clearInterval(timer);
timer=setInterval(function() {
var speed=(iTarget-oDiv.offsetTop)/6;
//alert(iTarget-oDiv.offsetTop);
//alert(iTarget);
//alert(speed);
speed=speed>0?Math.ceil(speed):Math.floor(speed); if(oDiv.offsetHeight==iTarget)
{
clearInterval(timer);
}
else
{
oDiv.style.top=oDiv.offsetTop+speed+'px';
}
},30);
} </script>
</head> <body style="height:2000px;">
<div id="div1"></div>
</body>
</html>

最新文章

  1. 欢迎加入threejs
  2. UISprite(NGUI)扩展 图片镂空
  3. Mongodb Manual阅读笔记:CH8 复制集
  4. Unity 逐步旋转
  5. 联想 thinkpad fn键关闭,优化使用
  6. 【mysql】添加对emoji的支持
  7. CSS重置代码和常用公共代码
  8. HDOJ_1010 Tempter of the Bone
  9. 关于linux-Centos 7下mysql 5.7.9的rpm包的安装方式 (转)
  10. CentOS 6.8编译安装httpd2.2.31+MySQL5.6.31+PHP5.3.27
  11. 解决WebStorm无法连接到Chrome
  12. 将Tomcat配置到你的mac电脑上,命令行启动tomcat
  13. Mysql error 1317导致从库复制断开
  14. STM32的优先级的理解及其使用
  15. 下载8000首儿歌的python代码
  16. 【资源大全】.NET资源大全中文版(Awesome最新版)
  17. C++ 实现Biginteger
  18. 算法笔记_184:历届试题 约数倍数选卡片(Java)
  19. RabbitMQ消息队列生产者和消费者
  20. Wunderlist 云端任务管理(Todo list)工具

热门文章

  1. nginx配置访问密码,输入用户名和密码才能访问
  2. angular2 单元测试 路由相关
  3. Java_Habse_add
  4. Django框架之ORM的相关操作之多对多三种方式(五)
  5. restful api的那些事
  6. lintcode算法周竞赛
  7. [转]工作量证明(PoW)权益证明(PoS)和委任权益证明(DPoS)区别
  8. 使用node查询数据库(mysql)时,日期格式不对的问题。
  9. RTT学习之sensor设备
  10. linux 系统 grep 命令 摘录过滤特定的行