Get the outer height of an element (including margin and border)
Option name | Type | Description |
---|---|---|
module | helper/outer-height.js |
outerHeight(el, computedStyles);
Option name | Type | Description |
---|---|---|
el | Element | |
styles | Object | Optional Already have computed styles? Pass them in. |
function outerHeight(el, styles) {
styles = styles || window.getComputedStyle(el);
var props = ['marginTop', 'marginBottom', 'borderTop', 'borderBottom'];
var height = el.clientHeight;
props.forEach(function(prop) {
height += parseInt(styles[prop] || 0, 10);
});
return height;
}
Base.exportjQuery(outerHeight, 'outerHeight');
return outerHeight;
}));