UNPKG

449 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = getElementPosition;
7
8/*
9 * Finds element's position relative to the whole document,
10 * rather than to the viewport as it is the case with .getBoundingClientRect().
11 */
12function getElementPosition(element) {
13 var rect = element.getBoundingClientRect();
14 return {
15 top: rect.top + window.pageYOffset,
16 left: rect.left + window.pageXOffset
17 };
18}
\No newline at end of file