# document-offset

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

Latest version **1.0.4** (published 2015-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install document-offset
pnpm add document-offset
yarn add document-offset
bun add document-offset
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2015-03-19 |
| First published | 2014-06-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 58 |
| Author | Tim Oxley |
| Maintainers | timoxley, tootallnate |
| Keywords | browser, coordinates |

## Links

- npm: https://www.npmjs.com/package/document-offset
- Repository: https://github.com/timoxley/offset
- Issues: https://github.com/timoxley/offset/issues
- npm.io page: https://npm.io/package/document-offset

## Dependencies (3)

- [dom-support](https://npm.io/package/dom-support.md) *
- [get-document](https://npm.io/package/get-document.md) 1.0.0
- [within-element](https://npm.io/package/within-element.md) 0.1.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2015-03-19
- 1.0.3 — 2014-12-12
- 1.0.2 — 2014-06-28

## README

# document-offset

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

## Installation

```
$ npm install document-offset
```

### [component(1)](http://component.io):

```
$ component install timoxley/offset
```

## API

### offset(el)

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

Example:

```js
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

---
_Source: https://npm.io/package/document-offset · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
