[jQuery] dimensions plugin: height() and width()

[jQuery] dimensions plugin: height() and width()

Hi everyone and Happy New Year 2007. I'm using Kevin Luck's <span style="font-weight: bold;">jScrollPane</span> plugin (<a href="http://kelvinluck.com/assets/jquery/jScrollPane/"> http://kelvinluck.com/assets/jquery/jScrollPane/
</a>), wich is great stuff but uses the plug in <span style="font-weight: bold;">Dimensions</span> wich overrides jQuery's functions <span style="font-weight: bold;">height()</span> and <span style="font-weight: bold;">
width()</span>. The diference between the two namespaces is that when you use this functions to obtain the dimensions of an object (ie: <span style="font-family: courier new,monospace;">$("#content").width()</span>
) jQuery returns an "integer" like <span style="font-family: courier new,monospace;">200</span>, but Dimensions returns a "string" like <span style="font-family: courier new,monospace;">200px</span>.
The problem is that I use this functions a lot to format my page's layout but I need to use the result in numeric expressions adding, substracting, etc and it can't be done if the result is not a number so I need to extract the
<span style="font-family: courier new,monospace;">px</span> out of the string. I was considering using a expression like
<span style="font-family: courier new,monospace;">
var newWidth = oldWidth.substring(0,indexOf("p")-1);
</span>
or even
<span style="font-family: courier new,monospace;">var newWidth = oldWidth.replace(/px/,"");</span>
but I could use some input about how you guys get around this issue the easy and fast way, since my page uses already a lot of script and I don't want to burden it even more.
Thanks.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/