I need the full height of a div, I\'m currently using
document.getElementById(\'measureTool\').offsetHeight
offsetHeig
Use all the props, margin, border, padding and height in sequence.
function getElmHeight(node) {
const list = [
'margin-top',
'margin-bottom',
'border-top',
'border-bottom',
'padding-top',
'padding-bottom',
'height'
]
const style = window.getComputedStyle(node)
return list
.map(k => parseInt(style.getPropertyValue(k), 10))
.reduce((prev, cur) => prev + cur)
}