喜悦国际村 
» 游客:  注册 | 登录 | 搜索 | 统计 | 帮助

RSS 订阅当前论坛  

喜悦证交所已经关闭

上一主题 下一主题
     
标题: [问题] 请教一下在ff中使用setInterval的问题  
 
熟人
中级会员
Rank: 3Rank: 3



UID 92185
精华 0
积分 332
帖子 476
金钱 332 喜悦币
威望 0
人脉 0
阅读权限 30
注册 2007-4-29
状态 离线
[广告]: q m
请教一下在ff中使用setInterval的问题

在ff中使用setInterval和setTimeout方法似乎都存在动画效果不流畅的问题
不知道是否是我的使用方法有问题 隔一段时间ff的效果就会“卡住”一会儿 而ie没有问题

代码如下 请高手指教

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>test</title>
<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[i].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>
<style type="text/css">
#console{
        position:relative;
        width:200px;
        height:80px;
        border:solid #000000 1px;
        overflow:hidden;
}
#line{
        position:absolute;
        width:300px;
        overflow:hidden;
        margin:0;
        padding:0;
        list-style-type:none;
        background-color:#99FFFF;
        left:10px;
        top:0px;
}
#line li{
        float:left;
        width:60px;
        height:80px;
        margin-left:5px;
        display:inline;
}
</style>
</head>

<body>
<div id="console">
        <ul id="line"><li style="background-color:#00FFFF;">1</li><li style="background-color:#CCCCCC;">2</li><li style="background-color:#33FFFF;">3</li><li style="background-color:#00FF00;">4</li><li style="background-color:#FF0000;">5</li><li style="background-color:#66CC33;">6</li><li style="background-color:#6699FF;">7</li></ul>
</div>
</body>
</html>




性格:馋 懒 奸 猾 坏
兴趣:吃 喝 嫖 赌 抽
职业:坑 蒙 拐 骗 偷
2007-6-21 05:46 PM#1
查看资料  发短消息  顶部
 
km3945 (km3945)
版主
Rank: 7Rank: 7Rank: 7
版主


UID 46538
精华 0
积分 1323
帖子 1287
金钱 1323 喜悦币
威望 0
人脉 0
阅读权限 100
注册 2004-11-8
状态 离线
[推荐阅读] 诚聘php程序员
改来改云.在FF下确实就这样子.我没办法..

改来改云.在FF下确实就这样子.我没办法..

给你个强点的吧..看看那个适合你就用下了.呵呵


 附件: 您所在的用户组无法下载或查看附件



学会用下半身来思考!
2007-6-22 01:04 PM#2
查看资料  Blog  发短消息  QQ  顶部
 
熟人
中级会员
Rank: 3Rank: 3



UID 92185
精华 0
积分 332
帖子 476
金钱 332 喜悦币
威望 0
人脉 0
阅读权限 30
注册 2007-4-29
状态 离线
[推荐阅读] 都什么样的贴村长会关注
这个好 学习一下 感谢版主



性格:馋 懒 奸 猾 坏
兴趣:吃 喝 嫖 赌 抽
职业:坑 蒙 拐 骗 偷
2007-6-22 02:01 PM#3
查看资料  发短消息  顶部
 
游戏人间
版主
Rank: 7Rank: 7Rank: 7
☞风云山庄大少爷☜


UID 62639
精华 2
积分 14642
帖子 7738
金钱 14493 喜悦币
威望 20
人脉 129
阅读权限 100
注册 2004-12-21
来自 广西人在北京
状态 离线
[推荐阅读] 请教个联动显示的问题
看来以后JS还是往JS版发比较好.



 
群号:6025396/6025252/19520091(广西PHP交流/PHP高级编程/算法交流) 寧可在嘗試中失敗,也不在保守中成功! 不為失敗找理由,只為成功找方法! 饿踢Blog
 
2007-6-22 03:51 PM#4
查看资料  访问主页  Blog  发短消息  顶部
     


  可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题 | 开通个人空间  


 




Powered by Discuz! 6.1.0  © 2001-2010 Comsenz Inc.
Processed in 0.022371 second(s), 6 queries

(冀ICP备05009913号) 管理员:sadly 邮箱/MSN: sadly@phpx.com QQ:824008(长隐) 清除 Cookies - - Archiver - WAP