Reputation: 73
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.
Upvotes: 6
Views: 3415
Reputation: 3
I had problem with offsetHeight
, I replaced it to scrollHeight
and it works for me.
Upvotes: 0
Reputation: 304
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.
Upvotes: 2