Different value of offsetwidth in firefox and chrome

I get different values ​​for offsetwidth for the same element in Firefox and Chrome, which causes the element to display incorrectly. Please suggest some solution in order to have consistency.

+4
source share
1 answer

I have the same problem when I download content via AJAX with Firefox 12.

Both Chrome and IE9 + report offsetWidth correctly after the completion of the ready state, but Firefox does not seem to have calculated it yet.

If you check the bit later (even sometimes delaying half a second), Firefox has the correct width.

I suspect someone was trying to make Firefox faster by issuing a ready-made signal before they would.

The original poster did not give details, but I suspect that this could be a problem.

Edit: PS The only way I found this to work correctly is to defer and continue checking until it has the correct value.

+2
source

Source: https://habr.com/ru/post/1399169/


All Articles