當在init();
中調用iKeyless.widget.Rotator.rotate();
函數時,我的旋轉橫幅腳本拋出「太多遞歸」錯誤。我想不通爲什麼,init();
只調用一次,有一個延遲()的第二個呼叫....當它扔「太多遞歸」我的旋轉橫幅腳本中的「遞歸太多」
return {
init: function() {
ui.container = $("#rotating-banner");
ui.thumbs = $("#rotating-banner .tabs .tab");
ui.banners = $("#rotating-banner .banner");
ui.fadeBox = $(".rotate .bd .fade-box");
ui.thumbs.each(function (idx, el) {
$(el).click(function() {
paused = true;
iKeyless.widget.Rotator.rotate.show(idx);
});
});
iKeyless.widget.Rotator.rotate();
},
show: function (idx) {
ui.fadeBox.css("display", "block");
ui.fadeBox.animate({
opacity: 1
},
.125,
function() {
$('.active', $(ui.banners[idx]).addClass('active').parent()).removeClass('active');
ui.fadeBox.animate({
opacity: 1
},
.125,
function() {
ui.fadeBox.css("display", "none");
});
});
},
rotate: function() {
if (!paused) {
this.show(counter);
counter = counter + 1;
if (counter === ui.thumbs.length) {
counter = 0;
}
iKeyless.widget.Rotator.rotate().defer(5000);
}
}
}
Tagwise - 這是原型而不是jQuery? – 2011-01-19 16:38:22