| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1057 人关注过本帖
标题:jquery中如何关闭settimeout循环
只看楼主 加入收藏
pigzee
Rank: 2
等 级:论坛游民
帖 子:20
专家分:69
注 册:2010-3-30
结帖率:100%
收藏
 问题点数:0 回复次数:1 
jquery中如何关闭settimeout循环
如题
js中
$timer=setTimeout("Times()",1000); //在1秒后运行Times();
function Times(){alert('Hello world')}; //Times() 的内容;
 clearTimeout($timer); //移除设置

jquery中使用了$,如何结束循环呢?我的函数是含有参数的。呵呵。

我一个22分,哈哈,给的分不多,见谅!
搜索更多相关主题的帖子: jquery settimeout 
2010-10-14 21:28
pigzee
Rank: 2
等 级:论坛游民
帖 子:20
专家分:69
注 册:2010-3-30
收藏
得分:0 
嘿嘿,我想到一个方法,设置一个状态位,呵呵。
类似,呵呵
function Shift(Obj){
                    var me = this;
                    if (typeof (Obj)=="string") this.Obj = document.getElementById(Obj);
                    else this.Obj = Obj;
                    this.Timer = 10;
                    this.Move = function (y1,y2)
                    {
                        
                        if(y1 == y2){
                            alert('---');
                            $("#cloneList").empty();
                        }else{
                            var y1 = parseInt(this.Obj.style.top,10);
                            var yc = Math.ceil(Math.abs(y1-y2)/20);
                            this.Obj.style.top = y1 + yc * (y1<y2?1:-1) + "px";
                            setTimeout(function (){me.Move(y1,y2)},me.Timer);
                        }                  
                    }
                }
2010-10-14 21:35
快速回复:jquery中如何关闭settimeout循环
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014248 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved