firefox和chrome中不同的offsetwidth值 [英] Different value of offsetwidth in firefox and chrome
问题描述
对于Firefox和Chrome中的相同元素,我得到了 offsetwidth
的不同值,这会使元素显示不正确。为了保持一致性,请提供一些解决方案。
我在使用Firefox通过AJAX加载内容时遇到了类似的问题12,
Chrome和IE9 +都在ready状态完成后正确地报告了offsetWidth,但是Firefox似乎还没有计算出它。
如果稍后检查一下(甚至有时延迟半秒),Firefox的宽度就会变大。
我怀疑有人试过通过发射准备好的信号之前,他们应该使Firefox更快。
原始海报没有提供很多细节,但我怀疑这可能是问题。
编辑:PS我发现让这个工作正常的唯一方法是延迟并继续检查,直到它具有正确的值。
I'm getting different values for offsetwidth
for the same element in Firefox and Chrome, which makes the element display incorrectly. Please suggest some solution so as to have consistency.
I'm having a similar issue when I load content via AJAX with Firefox 12.
Both Chrome and IE9+ report the offsetWidth correctly after the the ready state is complete, but Firefox hasn't seem to have calculated it yet.
If you check a bit later (even delaying a half second sometimes), Firefox has the right width.
I suspect someone tried to make Firefox faster by firing the ready signal before they should be.
The original poster didn't give a lot of details, but I suspect this might be the problem.
Edit: P.S. The only way I've found to get this to work correctly is to delay and keep checking back until it has the right value.
这篇关于firefox和chrome中不同的offsetwidth值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!