Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.
/ offset Public archive
forked from timoxley/offset

Get offset of an element within the document

License

Notifications You must be signed in to change notification settings

pilotcreative/offset

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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:

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

About

Get offset of an element within the document

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 60.3%
  • HTML 33.0%
  • Makefile 6.7%