我拿了这个片段,它工作得很好,但是如果萤火虫控制台说“递归过多”,火狐/萤火虫就会死去。这是一篇有类似问题的帖子,我觉得没有正确解决Jquery Too Much Recursion Error
有没有办法让这种颜色动画连续循环而不产生这个递归问题?如果没有,我怎样才能让它在没有递归的情况下工作?指定直到结束的时间量?
$(document).ready(function() {
spectrum();
function spectrum(){
var hue = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';
$('#welcome').animate( { backgroundColor: hue }, 1000);
spectrum();
}
});