【发布时间】:2011-01-19 16:14:37
【问题描述】:
当在init(); 中调用iKeyless.widget.Rotator.rotate(); 函数时,我的旋转横幅脚本抛出“递归过多”错误。我不知道为什么,init(); 只被调用一次,并且在第二次调用中有一个 defer() ......当页面加载它在抛出“太多递归”之前滞后
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 - 这是 Prototype 而不是 jQuery?
标签: javascript jquery