开发者

JS causing infinite loop in Firefox

开发者 https://www.devze.com 2023-01-25 16:36 出处:网络
A script on my page is causing an infinite loop in FireFox. Here is the Javascript: function expandMothersRings(new_height)

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开发者_StackOverflow中文版 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号