- This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
Viewing 10 posts - 1 through 10 (of 10 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › get height.
Hello,
how to get wrapper height if wrapper height: auto;? And when you get wrapper height then set on other element wrapper height.
var h = document.getElementById('wrapperDiv').clientHeight;
var h = document.getElementById('wrapperDiv').offsetHeight;
clientHeight includes any vertical padding.
offsetHeight includes any vertical padding, scrollBar, and the border.
how to set on element height?
Not sure what you’re doing or what the code is that you are weaving this into, but you could set it with:
document.getElementById('otherDiv').style.height = h; //The variable used in the previous example defining 'h' as the wrapper height.
Doesn’t work.
Don’t you want the #block height to equal the height of the #wrapper when #block is clicked? You have it setting #block height equal to #block height which is redundant.
Am, yes I want to do block equal to wrapper. Can you show how to do it?
Sorry. You can’t change clientHeight [facepalm]. Use the style object of your div. Here’s a new pen: http://codepen.io/anon/pen/sKruF
Thx :)
.. delete this post