vue-antd-ui
Version:
An enterprise-class UI design language and Vue-based implementation
12 lines (11 loc) • 343 B
JavaScript
/*
* Finds element's position relative to the whole document,
* rather than to the viewport as it is the case with .getBoundingClientRect().
*/
export default function getElementPosition(element) {
var rect = element.getBoundingClientRect();
return {
top: rect.top + window.pageYOffset,
left: rect.left + window.pageXOffset
};
}