Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YUI3: Whats the best way to read Height of an element?

Tags:

yui3

I want to increase height of an element by X pixels by writing a YUI3 script.

Whats the best way ?

if I use 'Node' module and read the height as node.getStyle("height");

The results of FF3 shows a string "100px" where as for IE8 its just blank. :(

Please help.

like image 301
Eastern Monk Avatar asked Feb 20 '11 11:02

Eastern Monk


1 Answers

node.getStyle('height') only returns a value when you have a value set in the style of the node. To get the height of a node with out a style set use node.getComputedStyle('height') or node.get('clientHeight').

If you have overflow set, you can use node.get('scrollHeight') to get the full height of the content.

To update the height of the node, use setStyle('height', value)

like image 198
apipkin Avatar answered Sep 22 '22 21:09

apipkin