offsetFromViewport

Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.dom.offset

Get the offset top and left of the passed element from the document top left point

Params

  1. $elm*-HTMLElement

    The element to get the offset from

Return

  1. -top: number; left: number;

    The offset top and left object

Example

import { offsetFromViewport } from '@blackbyte/sugar/dom'
const offsetFromViewport = offset($elm);
// output : { top : 200, left : 300 }

Todo

  • testsnormal