-
-
Save WesleySmits/bb7212290a111b4c69ddbdcea660cb1a to your computer and use it in GitHub Desktop.
Accessible Accordion: Utility function to get absolute height
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function getAbsoluteHeight(el) { | |
const styles = window.getComputedStyle(el); | |
const margin = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom); | |
return Math.ceil(el.offsetHeight + margin); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment