开发者

Javascript to get height of box dynamically

I have a table which displays some grid data for search results...Now the height of this table would vary each time.

So is there any way by which I could get the height of this dynamic table..

Basically I want to set an overflow:auto property for that table which would enable it to be scrolled on the iPad using 2-fin开发者_运维百科gers (I cannot do the scrolling using 1-finger as that table rows does the drag action for 1-finger)


Try :

var elem = document.getElementById("elementId");
var elemStyle = window.getComputedStyle(elem, null);
var height = elemStyle.getPropertyValue("height");


$('#tableid').height(); will get you the height (with jquery). I'm not sure how that's relevant to your desire to use overflow:auto.


You could try jQuery's height function.


You can get Dom element's hight using it's offsetHeight property.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜