Skip to content Skip to sidebar Skip to footer

Different Value Of Offsetwidth In Firefox And Chrome

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 con

Solution 1:

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.

Solution 2:

I had problem with offsetHeight, I replaced it to scrollHeight and it works for me.

Post a Comment for "Different Value Of Offsetwidth In Firefox And Chrome"