![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
相关问题
在ff中使用setInterval和setTimeout方法似乎都存在动画效果不流畅的问题
不知道是否是我的使用方法有问题 隔一段时间ff的效果就会“卡住”一会儿 而ie没有问题
代码如下 请高手指教
<script type="text/javascript">
function mList(id){
this._distance = 1;
this._interval = 10;
this._console = null;
this._totalLength = 0;
this._margins = 5;
if(null != id){
this._console = document.getElementById(id);
}
}
mList.prototype.ini = function(id){
this._console = document.getElementById(id);
var children = this._console.childNodes;
for(var i = 0;i < children.length;i ++){
this._totalLength += parseInt(children.clientWidth) + this._margins;
}
}
mList.prototype.goLeft = function(){
this._console.style.left = this._console.offsetLeft - this._distance + "px";
if(this._console.offsetLeft < 0-(parseInt(this._console.firstChild.clientWidth) + this._margins)){
this._console.appendChild(this._console.firstChild);
this._console.style.left = "0px";
}
}
mList.prototype.move = function(objName){
tt = setInterval(objName+".goLeft()", this._interval);
}
var tt = null;
var ll = null;
window.onload = function(){
ll = new mList();
ll.ini("line");
ll.move("ll");
}
</script>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
提问者:熟人 08-22 16:04
答复

