Socket
Socket
Sign inDemoInstall

@reach/observe-rect

Package Overview
Dependencies
0
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @reach/observe-rect

Observe the Rect of a DOM element.


Version published
Weekly downloads
420K
decreased by-16.31%
Maintainers
4
Install size
30.0 kB
Created
Weekly downloads
 

Readme

Source

Reach observeRect

Observe the rect of a DOM element.

Demo

Installation

npm install @reach/observe-rect
# or
yarn add @reach/observe-rect

Usage

import observeRect from "@reach/observe-rect";

let node = document.getElementById("some-node");

let rectObserver = observeRect(node, rect => {
  console.log("left", rect.left);
  console.log("top", rect.top);
  console.log("height", rect.height);
  console.log("width", rect.width);
});

// start observing
rectObserver.observe();

// stop observing
rectObserver.unobserve();

About

A lot of things can change the position or size of an element, like scrolling, content reflows and user input. This utility observes and notifies you when your element's rect changes.

MIT License Copyright (c) 2018-present, Ryan Florence

FAQs

Last updated on 22 Jun 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc