Chrome/jQuery未捕获范围错误:超过了最大调用堆栈大小(函数循环)
Chrome/jQuery Uncaught RangeError: Maximum call stack size exceeded (Function Loop)
所以我很困惑这是怎么发生的,但我的jQuery不知怎么引起了某种冲突,并将该选项卡的内存使用量增加到1.2gbs以上。
<script>
function homeFader(){
setTimeout(function() {
$("#homeBannerContainer").fadeOut(3000);
$(".bannerRightUnicef").animate({marginLeft:"457px"},0);
}, 3000);
setTimeout(function() {
$("#homeBannerContainerTwo").fadeOut(3000);
}, 8000);
setTimeout(function() {
$(".bannerRightUnicef").animate({marginLeft:"0px"},1000);
}, 9000);
setTimeout(function() {
$("#homeBannerContainer").fadeIn(3000,function() {
$("#homeBannerContainerTwo").css("display","block");
});
}, 13000);
setInterval(function() { homeFader(); },15000);
}
$(document).ready(function() {
homeFader();
});
</script>
有什么解决办法吗?
非常感谢
~马特
如注释中所述,在homeFader
中使用setTimeout()
而不是setInterval
function homeFader() {
setTimeout(function () {
$("#homeBannerContainer").fadeOut(3000);
$(".bannerRightUnicef").animate({
marginLeft: "457px"
}, 0);
}, 3000);
setTimeout(function () {
$("#homeBannerContainerTwo").fadeOut(3000);
}, 8000);
setTimeout(function () {
$(".bannerRightUnicef").animate({
marginLeft: "0px"
}, 1000);
}, 9000);
setTimeout(function () {
$("#homeBannerContainer").fadeIn(3000, function () {
$("#homeBannerContainerTwo").css("display", "block");
});
}, 13000);
setTimeout(homeFader, 15000);
}
$(document).ready(function () {
homeFader();
});
或者像一样调用setInterval
function homeFader() {
setTimeout(function () {
$("#homeBannerContainer").fadeOut(3000);
$(".bannerRightUnicef").animate({
marginLeft: "457px"
}, 0);
}, 3000);
setTimeout(function () {
$("#homeBannerContainerTwo").fadeOut(3000);
}, 8000);
setTimeout(function () {
$(".bannerRightUnicef").animate({
marginLeft: "0px"
}, 1000);
}, 9000);
setTimeout(function () {
$("#homeBannerContainer").fadeIn(3000, function () {
$("#homeBannerContainerTwo").css("display", "block");
});
}, 13000);
}
$(document).ready(function () {
homeFader();
setInterval(homeFader, 15000);
});
相关文章:
- 是什么让一个“;Uncaught RangeError:超过了最大调用堆栈大小“;错误(Chrome,在其他浏览器中显示
- 超过了async.detect最大调用堆栈大小
- 如何远程检查JavaScript应用程序的函数调用堆栈
- 超过了最大调用堆栈大小,循环无限
- 超过了最大调用堆栈大小.递归标签
- 日志:未捕获的范围错误:超过了最大调用堆栈大小
- 未捕获的范围错误:setTimeout()超过了最大调用堆栈大小
- JavaFX+WebView/Javascript:setTimeOut不起作用调用堆栈来自Java
- JavaScript继承:未捕获的范围错误:超过了最大调用堆栈大小
- 使用$cookies和$stateChangeStart检查sessionID是否超过了最大调用堆栈
- jQuery捕获"RangeError:超过了最大调用堆栈大小“;
- 设置这个.RangeError:超过了最大调用堆栈大小
- 收到“范围错误: 超出最大调用堆栈大小”错误
- 递归 - 测试最大堆栈大小时,调用堆栈无法弹出
- 轮询 ajax 函数超出调用堆栈
- Chrome RangeError:使用jQuery$.map时超过了最大调用堆栈大小
- 要求JS 2.1.9引起“;最大调用堆栈"使用Grunt时出错
- Chrome/jQuery未捕获范围错误:超过了最大调用堆栈大小(函数循环)
- 超过了最大调用堆栈大小-没有明显的递归
- 在 javascript 中使用函数堆栈调用非递归方法