All Projects → timoxley → offset

timoxley / offset

Licence: MIT License
Get offset of an element within the document

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
Makefile
30231 projects

document-offset

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

Installation

$ npm install document-offset

component(1):

$ component install timoxley/offset

API

offset(el)

Get offset of an element within the document (relative to the top left of the document).

Example:

var offset = require('document-offset')
var target = document.getElementById('target')
console.log(offset(target))
// => {top: 69, left: 108}

Credit

Code adapted from jQuery.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].