parseInt % and px problem
<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 %)?
Try this one parseInt($("div")[0].style.top, 10)
Try to use .offset().top
or .position().top
instead
精彩评论