utilizes.offset

Get the current offset of the given element

Usage no npm install needed!

<script type="module">
  import utilizesOffset from 'https://cdn.skypack.dev/utilizes.offset';
</script>

README

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.