2010-11-16 116 views
0

我的页面上的脚本导致FireFox中的无限循环。JS导致Firefox中无限循环

这里是JavaScript:

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

这是正在通过ExternalInterface称为从Flex对象:

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

有一个在IE或Chrome没有问题。但由于某种原因,expandMothersRings函数在FF中无限循环。

flex对象不期望从Javascript返回任何值。此外,如果我改变JS功能看起来像:

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

然后它只执行一次。因此,函数中的某些内容导致它在Firefox中循环。

我不知道是什么?

这里是the page

+0

该页面不断尝试重新加载我在FF ..可能是什么导致你的问题? – drudge 2010-11-16 22:22:59

+0

“动画完整”方法中有任何代码吗? – 2010-11-17 15:54:08

+0

@Shadow Wizard,不,我没有,我想我可能会添加一些,所以我正在调试时留下它那样的评论,但并不需要。事实证明,我并不是真的需要它来制作动画,因为你可以看到我将它设置为100ms。我改变它不动画,只是设置它,解决了这个问题。 – 2010-11-17 16:24:30

回答

0

我更换

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

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

这固定的问题。