Javascript Mootools'。jQuery中的期刊等价物
我将一些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
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
);
}