0

問題は、最後から 5 行目の 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>&nbsp;&nbsp;&nbsp; <a style='font-family:Arial, Helvetica, sans-serif' class='" + newUpdate.clientId + " mp'> &nbsp;&nbsp;|&nbsp; Join Chat &nbsp;</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;
}
4

1 に答える 1

0

これは継続的に発生$(".nodata").hide();し、jquery アニメーション キューに追加されます。これを次のように書きます...

if (updateIterator === 0 && !$(".nodata").is(":hidden")) {
            $(".nodata").hide();
}
于 2012-08-07T02:19:48.010 に答える