offset.js 267 B

123456
  1. export function getOffset(element, parent) {
  2. return {
  3. top: Math.round(element.getBoundingClientRect().top - parent.getBoundingClientRect().top),
  4. left: Math.round(element.getBoundingClientRect().left - parent.getBoundingClientRect().left)
  5. };
  6. }