Abel Tamayo wrote: > Hi everyone and Happy New Year 2007. I'm using Kevin Luck's jScrollPane > plugin (http://kelvinluck.com/assets/jquery/jScrollPane/ > <http://kelvinluck.com/assets/jquery/jScrollPane/>), wich is great stuff > but uses the plug in Dimensions wich overrides jQuery's functions > height() and width(). The diference between the two namespaces is that > when you use this functions to obtain the dimensions of an object (ie: > $("#content").width() ) jQuery returns an "integer" like 200, but > Dimensions returns a "string" like 200px. > 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 px out of the string. I was considering using a > expression like > > var newWidth = oldWidth.substring(0,indexOf("p")-1); > > or even > > var newWidth = oldWidth.replace(/px/,""); > > 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.
Happy New Year! I'm not sure if the dimensions plugin should be changed to return integers... If not you can use the following to change the strings into the correct ints: var newWidth = parseInt(oldWidth) || 0; Hope that helps, Kelvin :) _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/