antdv-eoi
Version:
An enterprise-class UI design language and Vue-based implementation
18 lines (16 loc) • 449 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getElementPosition;
/*
* Finds element's position relative to the whole document,
* rather than to the viewport as it is the case with .getBoundingClientRect().
*/
function getElementPosition(element) {
var rect = element.getBoundingClientRect();
return {
top: rect.top + window.pageYOffset,
left: rect.left + window.pageXOffset
};
}
;