View Full Version : Proportional element dimensions?
brian.moeskau
11-15-2006, 07:59 PM
The params for element.setHeight do not specify units, but I assume everything is px right? Is there any chance of supporting 'unit' as an optional enum-type param (em, %, etc.)? I'd like to be able to specify BorderLayout region dimensions in em's so that they'll scale appropriately if the user increases or decreases the browser text size.
jack.slocum
11-16-2006, 12:21 AM
The problem is that an element's width/height is returned by the browser in pixels, not ems. So trying to calculate with ems isn't really an option.
You can cancel calculations and adjustments (not recommended) by using strings instead numbers:
element.setWidth('1.2em');
The element object won't adjust that.
Also, for elements you can change the default unit.
element.defaultUnit = 'em';
and then that unit will be appended to size operations instead of px.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.