utilizes.offset

v1.1.10
Get the current offset of the given element
offset util

offset

Get the current offset of the given element

Usage: offset(item: Element | Partial<ClientRect> | Partial<DOMRect>): { top: number, left: number }

import { offset } from 'utilizes.offset'

const specialElement = document.getElementById('special-element')

offset(specialElement)
// Output the offset top and offset left of given element
offset(specialElement.getBoundingClientRect())
// also work

This module exported from utilizes project.

npm i utilizes.offset

Metadata

  • MIT
  • Whatever
  • Natan Farkash
  • released 5/31/2021

Downloads

Maintainers