【发布时间】:2014-02-16 23:42:48
【问题描述】:
我知道这个 jQuery 错误是问题所在。但是您可能会看到,此错误对于解决问题根本没有多大帮助。我使用 jQuery 1.10.2 并在 1.3 版中有一个名为 jRumble 的插件。
现在这个脚本出现了错误:
jQuery(document).ready(function() {
jQuery('.landing-bar').jrumble({
x: 1,
y: 1,
rotation: 0
});
var rumbleStart = function() {
jQuery('.landing-bar').trigger('startRumble');
setTimeout(rumbleStop, 200);
};
var rumbleStop = function() {
jQuery('.landing-bar').trigger('stopRumble');
setTimeout(rumbleStart, 785);
};
rumbleStart();
animateScroll();
});
function animateScroll() {
jQuery('.landing-bar').animate({
width: '100%'
}, {
duration: 30000,
easing: 'linear',
complete:function() {
jQuery(this).css("width","0%");
}
});
animateScroll();
}
我的代码有什么问题?我认为可能是 jQuery 1.10 的语法错误..
感谢您的帮助!
【问题讨论】:
-
你在
animateScroll中发生了一个无限递归......你为什么在animateScroll里面调用animateScroll -
你有这个小提琴吗?抛出错误时调用的是什么方法?
-
使用
setTimeout(animateScroll,30000)而不是直接调用animateScroll,或者最好在动画完成回调中调用animateScroll() -
@ArunPJohny 必须是这样。它是一个加载栏,当它达到 100% 时应该开始宽度为 100% .. 我不能那样做吗?
-
@ArunPJohny 能够一次又一次地启动整个“增长到 100%”的过程
标签: javascript jquery