<div style="left: 100%"></div>
parseInt($("div").css("left"), 10);
When I try to get value of left
, some browsers give result in pixels, some in %.
Here is an example http://jsfiddle.net/WTt4s/1/
Google Chrome gives percent value, IE9 gives pixels instead.
How do I get the same value in all browsers (px or %)?
top
? Is it still in percent or have the browsers converted it to pixels? If it is still in percent, what happens if you strip the '%' character before doing the parseInt? --$("div").css("top").replace('%','')
– Atmospherealert($("div").css("top"))
in place of theparseInt
? – Geoid