schmelczer-dev/src/framework/helper/get-height.ts
Schmelczer András 969ccac690 Refactor
2020-01-04 10:24:07 +01:00

11 lines
352 B
TypeScript

export const getHeight = (e: HTMLElement): number => {
const computedStyle = window.getComputedStyle(e);
return (
// ignores margin collapse
e.clientHeight +
parseInt(computedStyle.marginTop) +
parseInt(computedStyle.marginBottom) +
parseInt(computedStyle.borderTopWidth) +
parseInt(computedStyle.borderBottomWidth)
);
};