Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Mootools'。jQuery中的期刊等价物_Javascript_Jquery_Mootools - Fatal编程技术网

Javascript Mootools'。jQuery中的期刊等价物

Javascript Mootools'。jQuery中的期刊等价物,javascript,jquery,mootools,Javascript,Jquery,Mootools,我将一些Mootools脚本翻译成jQuery,我有以下功能: play:function( delay, direction, wait ) { this.isRun = this[direction].periodical(delay,this,true); } 由该[方向]替代的一个from函数的标题为: next:function(manual , item) 我发现的唯一问题是:使用setInterval,但如何将参数传递给调用? 例如: setInterva

我将一些Mootools脚本翻译成jQuery,我有以下功能:

play:function( delay, direction, wait )
{       
    this.isRun = this[direction].periodical(delay,this,true);
}
由该[方向]替代的一个from函数的标题为:

next:function(manual , item)
我发现的唯一问题是:使用setInterval,但如何将参数传递给调用?
例如:

setInterval(direction + '(' + delay + ', this)')
调试非常困难,而且不美观…

这里是否有更漂亮的方法,或许可以使用其他方法?

看起来您需要一个匿名函数。试着这样做:

play:function( delay, direction, wait )
{       
    this.isRun = setInterval(function(){
            this[direction].call(this, true)
        },
        delay
    );
}