# @f/element-rect

> Get the bounding rect of an element, optionally relative to a particular parent

Latest version **1.0.0** (published 2016-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @f/element-rect
pnpm add @f/element-rect
yarn add @f/element-rect
bun add @f/element-rect
```

## 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.0 |
| Published | 2016-02-25 |
| First published | 2016-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | f |

## Links

- npm: https://www.npmjs.com/package/@f/element-rect
- Repository: https://github.com/micro-js/element-rect
- Homepage: https://github.com/micro-js/element-rect#readme
- Issues: https://github.com/micro-js/element-rect/issues
- npm.io page: https://npm.io/package/@f/element-rect

## Recent versions

- 1.0.0 (latest) — 2016-02-25

## README

# element-rect

[![Build status][travis-image]][travis-url]
[![Git tag][git-image]][git-url]
[![NPM version][npm-image]][npm-url]
[![Code style][standard-image]][standard-url]

Get the bounding rect of an element, optionally relative to a particular parent

## Installation

    $ npm install @f/element-rect

## Usage

Use this to get the offset of an element relative to another on the page. This is useful for positioning things like tooltips and other overlays that appear near another element.

## API

### elementRect(node, offsetParent)

- `node` - The node who's rect you want to get
- `offsetParent` - The parent node you want the offset relative to. Usually `node.offsetParent` (passing `true` is shorthand for this).

**Returns:** The rect `{top, left, width, height}` of `node` relative to `offsetParent` (or absolute, if unspecified).

## License

MIT

[travis-image]: https://img.shields.io/travis/micro-js/element-rect.svg?style=flat-square
[travis-url]: https://travis-ci.org/micro-js/element-rect
[git-image]: https://img.shields.io/github/tag/micro-js/element-rect.svg?style=flat-square
[git-url]: https://github.com/micro-js/element-rect
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: https://github.com/feross/standard
[npm-image]: https://img.shields.io/npm/v/@f/element-rect.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@f/element-rect

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