Have ideas to improve npm?Join in the discussion! »

offset-in-viewport

0.0.1 • Public • Published

offset

Get offset of a dom element 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

Install

npm i offset-in-viewport

DownloadsWeekly Downloads

100

Version

0.0.1

License

none

Last publish

Collaborators

  • avatar