Function: getBoundingClientPosition()
ts
function getBoundingClientPosition(ele): ClientXY;Gets the client (x, y) coordinates of the specified element relative to the viewport.
Parameters
| Parameter | Type | Description |
|---|---|---|
ele | HTMLElement | The element to get the bounding client for. |
Returns
ClientXY
The client (x, y) coordinates of the element.
Example
ts
const el = document.createElement('div')
document.body.appendChild(el)
const bounds = getBoundingClientPosition(el)
bounds // => { x: 0, y: 0 }Since
1.0.0