问题是从最后第五行开始,如果我删除该行,jQuery的动画功能将正常运行,否则它将使浏览器崩溃(尤其是Firefox),但我需要该动画功能以使用户意识到新的更新...可以任何人都可以告诉我为什么动画功能会导致浏览器崩溃???
function doAnimation() {
var newUpdate = newUpdates.updates[updateIterator] != null ? newUpdates.updates[updateIterator] : null;
var update = "";
while (newUpdate != null) {
if (updateIterator == 0) {
$(".nodata").hide();
}
lastupdateTime = newUpdate.lastUpdate;
update += "<div class='live-updates-data'><img width='48px' height='48px' class='" + newUpdate.clientId + "' src='company_logo/thumb/" + newUpdate.img + "' align='logo' onerror='showDefaultimage(this);' /><h2><span>" + newUpdate.title + "</span></h2> <a style='font-family:Arial, Helvetica, sans-serif' class='" + newUpdate.clientId + " mp'> | Join Chat </a><p>" + newUpdate.updateMessage + "</p></div>";
updateIterator++;
newUpdate = newUpdates.updates[updateIterator] != null ? newUpdates.updates[updateIterator] : null;
} // end of while
// after finishing the while loop
if (update != "") {
$("#shoutBox").prepend(update);
$("#shoutBox div:first-child").animate({
"height": "toggle"
}, "slow", "linear");
}
oTimeout = setTimeout(getShouts, timoutSpeed); //Again start the timout function to ge
updateIterator = 0;
return false;
}
请您参考如下方法:
这将持续触发$(".nodata").hide();,它将附加在jquery动画队列中。
写为...
if (updateIterator === 0 && !$(".nodata").is(":hidden")) {
$(".nodata").hide();
}


