不知道有哪些需要改进的地方或者不兼容的地方
<script type="text/javascript">
var $=function(ID){return document.getElementById(ID);};
var timer=null,speed=36,y=0.1;
window.onscroll=function(){
if(timer) {
clearTimeout(timer);
}
timer=null;
;(function(){
st=document.body.scrollTop||document.documentElement.scrollTop;
if(parseInt($("test").style.top)<st+120){
$("test").style.top=parseInt($("test").style.top)+Math.ceil((st+120-parseInt($("test").style.top))*y)+"px";
} else if(parseInt($("test").style.top)>st+120){
$("test").style.top=parseInt($("test").style.top)-Math.ceil((parseInt($("test").style.top)-120-st)*y)+"px";
} else {
clearTimeout(timer);
timer=null;
}
timer=setTimeout(arguments.callee,speed);
})();
}
//page 287 event2
//page 312 oscroll
</script>
<script type="text/javascript">
var $=function(ID){return document.getElementById(ID);};
var timer=null,speed=36,y=0.1;
window.onscroll=function(){
if(timer) {
clearTimeout(timer);
}
timer=null;
;(function(){
st=document.body.scrollTop||document.documentElement.scrollTop;
if(parseInt($("test").style.top)<st+120){
$("test").style.top=parseInt($("test").style.top)+Math.ceil((st+120-parseInt($("test").style.top))*y)+"px";
} else if(parseInt($("test").style.top)>st+120){
$("test").style.top=parseInt($("test").style.top)-Math.ceil((parseInt($("test").style.top)-120-st)*y)+"px";
} else {
clearTimeout(timer);
timer=null;
}
timer=setTimeout(arguments.callee,speed);
})();
}
//page 287 event2
//page 312 oscroll
</script>
解决方案 »
- 打印弹出框怎么确定用户点击的是“打印”还是“取消”按钮
- WdatePicker 只能选择今天和今天以后的期日的8点到20点的时间
- 跪求 js全屏后出现的问题!..........................
- 怎样才能在淘宝的编辑器上执行javascript?
- 0nMouseout回帖就给分
- 请问下谷歌浏览器怎么调用onunload()
- 500个录入页面,页面包含各种输入框,有的输入框只能输入数字,有的只能输入英文,求便捷的解决方式
- Replace问题,请教高手!
- 请问如何定义一个二维数组,如何使用它
- 动态的换音乐的问题?
- 关于js字符串的属性过滤。
- 这个js文件哪错了啊?请各位路过的高手指点!
<head>
<title></title>
</head>
<body>
<div style="height:2048px;">fasdf</div>
<div id="test" style="width:120px;height:48px;border:1px solid #e9e9e9;position:absolute;right:4px;top:120px;">fasdf</div><script type="text/javascript">
var $=function(ID){return document.getElementById(ID);};
var timer=null,speed=36,y=0.1;
window.onscroll=function(){
if(timer) {
clearTimeout(timer);
}
timer=null;
;(function(){
st=document.body.scrollTop||document.documentElement.scrollTop;
if(parseInt($("test").style.top)<st+120){
$("test").style.top=parseInt($("test").style.top)+Math.ceil((st+120-parseInt($("test").style.top))*y)+"px";
} else if(parseInt($("test").style.top)>st+120){
$("test").style.top=parseInt($("test").style.top)-Math.ceil((parseInt($("test").style.top)-120-st)*y)+"px";
} else {
clearTimeout(timer);
timer=null;
}
timer=setTimeout(arguments.callee,speed);
})();
}
//page 287 event2
//page 312 oscroll
</script>
</body>
</html>