UNPKG

@studiometa/js-toolkit

Version:

A set of useful little bits of JavaScript to boost your project! 🚀

27 lines (26 loc) • 498 B
function getOffsetSizes(element) { let parent = element; let x = -window.scrollX; let y = -window.scrollY; while (parent) { x += parent.offsetLeft; y += parent.offsetTop; parent = parent.offsetParent; } const width = element.offsetWidth; const height = element.offsetHeight; return { x, y, width, height, top: y, right: width + x, bottom: height + y, left: x }; } export { getOffsetSizes }; //# sourceMappingURL=getOffsetSizes.js.map