1.0.4 • Published 6 years ago

recursive-calc-element-coords v1.0.4

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

Information

Get the position of an element relative to the document. The DOM element can be nested inside absolute/relative/fixed elements, and it'll reliably get you the absolute pixel coords.

Returns an object {x: number 0, y: number 0}

Install

npm install --save recursive-calc-element-coords

Usage

import calcCoords from 'recursive-calc-element-coords'

const coords = calcCoords(document.getElementById('#really-nested-element'))

//--"coords"-->
// {
//   x: [Number],
//   y: [Number]
// }
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago