2008-03-28
网页元素跟随BODY上下滚动JS组件
UpDownRoller.prototype.uid=100;
function UpDownRoller(objID,selfName){
var obj=document.getElementById(objID);
obj.style.position="relative";
obj.style.zIndex=this.uid++;
this.target=obj;
this.autoRoll=false;
this.selfName=selfName;
this.timerID=null;
}
UpDownRoller.prototype.setAutoRoll=function(b){
if(this.autoRoll==b){
return null;
}
this.autoRoll=b;
if(b){
if(this.timerID){
window.clearInterval(this.timerID);
}
this.timerID=window.setInterval(this.selfName+".roll()",10);
}else{
this.target.style.pixelTop=0;
}
}
UpDownRoller.prototype.roll=function(){
if(!this.autoRoll){
return false;
}
var t=this.target;
t.style.pixelTop=document.body.scrollTop;
}
if(document.getElementById("floater")){
var ft=new UpDownRoller("floater","ft");
ft.setAutoRoll(true);
}
- 17:19
- 浏览 (55)
- 评论 (0)
- 分类: web js css
- 进入论坛
- 相关推荐
发表评论
提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则
- 浏览: 514 次
- 性别:

- 来自: 厦门

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
jsp 静态include和动态in ...
解释的不错,就是太少了
-- by 刘鹏超 -
基于数据库的无限级树形结 ...
明白了,是不是已经有人讨论过了。 但是好像看其他的查找实现都是基于递归的的实现, ...
-- by yangzhichao -
基于数据库的无限级树形结 ...
估计是不是少了代码说明了,只有长长的代码?
-- by yangzhichao -
基于数据库的无限级树形结 ...
请问“新手帖”什么意思呢?
-- by yangzhichao






评论排行榜