Skip to content

Instantly share code, notes, and snippets.

@bitsmanent
Created December 19, 2018 17:28
Show Gist options
  • Save bitsmanent/e4f71b5ad4c1b1a5042b5a759e8d86e2 to your computer and use it in GitHub Desktop.
Save bitsmanent/e4f71b5ad4c1b1a5042b5a759e8d86e2 to your computer and use it in GitHub Desktop.
Compute full height of an element
function getheight(el) {
var props = ["height", "marginTop", "marginBottom", "borderTop"];
var s = getComputedStyle(el), ret = 0;
if(!s) return 0;
props.forEach((p) => ret += parseFloat(s[p]));
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment