Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 consistency.

like image 645
Pulkit Avatar asked Nov 04 '22 04:11

Pulkit


1 Answers

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.

like image 62
Jason Hanley Avatar answered Nov 09 '22 06:11

Jason Hanley