Similar to this question: http://stackoverflow.com/questions/744319/get-css-rules-percentage-value-in-jquery
However, I am writing a plugin and it needs to deal with it gracefully dependent on how the width was originally specified. If the element was originally specified in pixels it is fine as that is the value that .width()
, .innerWidth()
, outerWidth()
and .css('width')
return.
But I want to know if it was original set as a percentage. So that if the container element resizes then I know to recalculate the width that I have set on my element.
Is this possible? The only thing I can think of is trying to loop through document.stylesheets looking for relevant rules but I think that will be more or less impossible to do generically. Any other ideas?
Thanks!