开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜