简体   繁体   中英

JS causing infinite loop in Firefox

A script on my page is causing an infinite loop in FireFox.

Here is the Javascript:

function expandMothersRings(new_height)
{
    window.scrollTo(0, 0);
    $('#mr-container').animate({
        height: new_height
    }, 100, function() {
        // Animation complete.
    });
}

This is being called via ExternalInterface from a Flex object:

var tiles_height:Number = 175+Math.ceil(MothersRingData.getInstance().styleArrayCollection.length/4)*175;
ExternalInterface.call("expandMothersRings", tiles_height + 300);

There is no issue in IE or Chrome. But for some reason the expandMothersRings function is infinitely looping in FF.

The flex object is not expecting any return value from Javascript. Also if I change the JS function to look like:

function expandMothersRings(new_height)
{
    alert(new_height);
}

Then it only executes once. So something in the function is causing it to loop in Firefox.

I do not know what?

Here is the page

I replaced

$('#mr-container').animate({
    height: new_height
}, 100, function() {
    // Animation complete.
});

with

$("#mr-container").height(new_height);

That fixed the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM