开发者

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

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.


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜