visible-part-of

Get the current x and y of given element. also return the offset.

Usage no npm install needed!

<script type="module">
  import visiblePartOf from 'https://cdn.skypack.dev/visible-part-of';
</script>

README

visiblePartOf

Get the current x and y of given element. also return the offset.

Usage: visiblePartOf(element: HTMLElement): { x: number, y: number, offsetTop: number, offsetLeft: number }

import { visiblePartOf } from 'visible-part-of'

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

visiblePartOf(specialElement)
// Output the x and y of the element, also give you information about the current offset top and left

This module exported from utilizes project.