Skip to content

Repository files navigation

document-offset

Get offset of a DOM Element or Range within the document.

Installation

$ npm install document-offset
$ component install timoxley/offset

API

offset(el)

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}

Credit

Code adapted from jQuery.

License

MIT

About

Get offset of an element within the document

Resources

Stars

58 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages