find-pos

returns the absolute position of an HTML element

Usage no npm install needed!

<script type="module">
  import findPos from 'https://cdn.skypack.dev/find-pos';
</script>

README

find-pos

be well aware that absolute pos

npm install find-pos

usage

var findPos = require('find-pos');

var div = document.createElement('div')
div.style.position = 'absolute'
div.style.top = '300px'
div.style.left = '300px'

document.body.appendChild(div)

console.log(findPos(div)) // [300,300];