This package has been deprecated

Author message:

Renamed package to document-offset.

timoxley-offset

1.0.1 • Public • Published

offset

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

Installation

$ component install timoxley/offset

API

offset(el)

Get offset of an element within the viewport.

Example:

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

Credit

Code adapted from jQuery.

License

MIT

/timoxley-offset/

    Package Sidebar

    Install

    npm i timoxley-offset

    Weekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • timoxley
    • tootallnate