Socket
Socket
Sign inDemoInstall

size-sensor

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

size-sensor

DOM element size sensor which will callback when size changed.


Version published
Weekly downloads
375K
increased by10.1%
Maintainers
1
Weekly downloads
 
Created

What is size-sensor?

The size-sensor npm package is used to detect changes in the size of an HTML element. It can be useful for responsive design, dynamic content adjustments, and other scenarios where you need to react to changes in element dimensions.

What are size-sensor's main functionalities?

Detecting size changes

This feature allows you to bind a callback function to an HTML element that will be called whenever the size of the element changes.

const { bind, clear } = require('size-sensor');

const element = document.getElementById('myElement');

bind(element, () => {
  console.log('Element size changed!');
});

Unbinding size change detection

This feature allows you to unbind the size change detection from an HTML element, stopping the callback from being called when the element's size changes.

const { bind, clear } = require('size-sensor');

const element = document.getElementById('myElement');

const sensor = bind(element, () => {
  console.log('Element size changed!');
});

// Later, if you want to stop detecting size changes
clear(sensor);

Other packages similar to size-sensor

Keywords

FAQs

Package last updated on 30 Aug 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc