sober
Version:
Sober is a library of UI components designed with reference to Material You.
14 lines (13 loc) • 435 B
JavaScript
const div = document.createElement('div');
div.setAttribute('style', 'position: fixed;right: 0;bottom: 0;width: 100%;height: 100%;pointer-events: none');
export const getStackingContext = (el) => {
el.appendChild(div);
const DOMRect = div.getBoundingClientRect();
el.removeChild(div);
return {
left: DOMRect.left,
top: DOMRect.top,
width: DOMRect.width,
height: DOMRect.height
};
};