开发者

Javascript to get height of box dynamically

开发者 https://www.devze.com 2023-03-22 09:16 出处:网络
I have a table which displays some grid data for search results...Now the height of this table would vary each time.

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

精彩评论

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