The following javascript code returns two different values for Chrome and Firefox for the same page element.
$('.abc').css("top");
Chrome returns: 114px
while Firefox returns 114.1230px
I’ve tried this several times on the same page and Chrome consistently chops off the decimal point and the following digits.
Any suggestions on how I can get the full value within Chrome as well?
Firefox is a little special in this case… it supports decimal pixels. This means that if you set a height OR width on f.e. an image, it will resize the picture and this calculation will contain (most likely) decimal pixels. This is the same with divs, it gets calculated and decimals are used in firefox.
As far as I know, firefox is the only major browser that support decimals…
If you need full pixels, try a regex expression or something to remove the decimals if you have a string or
floor()if you have a number.