13
好吧,所以我有这个原型对象阶段,除了这个递归调用,它的每一部分工作。原型函数内的递归调用
Stage.prototype.start = function(key) {
//var maxScrollLeft = document.getElementById("content").scrollWidth;
$content.scrollLeft($content.scrollLeft() + this.initspeed);
if(key < this.maxScrollLeft || key > 0) {
setTimeout(function() {
this.start(key+2);
},1);
}else{
console.log("stop");
}
}
我试着让这个在Stage.prototype.start的if语句称为内这一点,使用this.start();然而我总是得到 Uncaught TypeError: Object [object global] has no method 'start'
我认为这与匿名函数中的调用有关,我如何解决这个问题的任何想法?