Get the height/width in % using jQuery -


i dynamically resize elements using jquery.

in of cases, it's going well, call $(selector).css('height'); height/width values or $(selector).height();.

it provides me value in px, if setted in % in stylesheet.

but sometimes, returns value in %, wondering, there way sure value in px ? how "prevent" format ?

edit

i take - i'm not sure if jquery ever returns % value, if specify in css - inline or otherwise (although leave original answer intact).

can provide example of when % value returned?

original

.css() value applied directly element:

  <div style="height: 75%;"> 

.height() get's height of element in dom - in pixels.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -