diff options
Diffstat (limited to 'app/assets/javascripts/lib/utils/dom_utils.js')
-rw-r--r-- | app/assets/javascripts/lib/utils/dom_utils.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/dom_utils.js b/app/assets/javascripts/lib/utils/dom_utils.js index bca6978c206..cafee641174 100644 --- a/app/assets/javascripts/lib/utils/dom_utils.js +++ b/app/assets/javascripts/lib/utils/dom_utils.js @@ -106,3 +106,15 @@ export const setAttributes = (el, attributes) => { el.setAttribute(key, attributes[key]); }); }; + +/** + * Get the height of the wrapper page element + * This height can be used to determine where the highest element goes in a page + * Useful for gl-drawer's header-height prop + * @param {String} contentWrapperClass the content wrapper class + * @returns {String} height in px + */ +export const getContentWrapperHeight = (contentWrapperClass) => { + const wrapperEl = document.querySelector(contentWrapperClass); + return wrapperEl ? `${wrapperEl.offsetTop}px` : ''; +}; |