Get offset of a DOM Element or Range within the document.
$ npm install document-offset
$ component install timoxley/offset
Get offset of an element within the document (relative to the top left of the document).
Example:
varoffset=require('document-offset')vartarget=document.getElementById('target')console.log(offset(target))// => {top: 69, left: 108}Code adapted from jQuery.
MIT