Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 %)?

like image 335
James Avatar asked May 09 '11 14:05

James


1 Answers

Try this one parseInt($("div")[0].style.top, 10)

like image 107
DanielB Avatar answered Sep 30 '22 08:09

DanielB