简体   繁体   English

JS在Firefox中导致无限循环

[英]JS causing infinite loop in Firefox

A script on my page is causing an infinite loop in FireFox. 我页面上的脚本正在FireFox中引起无限循环。

Here is the Javascript: 这是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: 这是通过Flex对象的ExternalInterface调用的:

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. IE或Chrome中没有问题。 But for some reason the expandMothersRings function is infinitely looping in FF. 但是由于某种原因, expandMothersRings函数在FF中无限循环。

The flex object is not expecting any return value from Javascript. flex对象不希望Javascript返回任何值。 Also if I change the JS function to look like: 另外,如果我将JS函数更改为:

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

Then it only executes once. 然后,它仅执行一次。 So something in the function is causing it to loop in Firefox. 因此,该函数中的某些内容导致其在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. 这解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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