document-offset
Get offset of a DOM Element or Range within the document
Last updated 10 years ago by timoxley .
MIT · Repository · Bugs · Original npm
$ cnpm install document-offset 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.4                                ...           latest (10 years ago)

1 Versions

  • 1.0.4                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org