Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

detect-element-overflow

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-element-overflow

A function that tells you whether a given element is overflowing its container or not. Useful for creating dropdowns and tooltips.

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
227K
decreased by-12.17%
Maintainers
1
Weekly downloads
 
Created
Source

downloads build dependencies dev dependencies tested with jest

Detect-Element-Overflow

A function that tells you whether a given element is overflowing its container or not. Useful for creating dropdowns and tooltips.

tl;dr

  • Install by executing npm install detect-element-overflow or yarn add detect-element-overflow.
  • Import by adding import detectElementOverflow from 'detect-element-overflow'.
  • Do stuff with it!
    const collisions = detectElementOverflow(child, parent);
    

User guide

Detect-Element-Overflow returns an object with getter functions described below.

Attribute nameDescriptionExample values
collidedTopWhether or not child element collided with the top parent's border.true
collidedBottomWhether or not child element collided with the bottom parent's border.true
collidedLeftWhether or not child element collided with the left parent's border.true
collidedRightWhether or not child element collided with the left parent's border.true
overflowTopHow many pixels of child have crossed top parent's border. Negative values specify how many pixels are between the child and the top parent's border.20, -15
overflowBottomHow many pixels of child have crossed bottom parent's border. Negative values specify how many pixels are between the child and the bottom parent's border.20, -15
overflowLeftHow many pixels of child have crossed left parent's border. Negative values specify how many pixels are between the child and the left parent's border.20, -15
overflowRightHow many pixels of child have crossed right parent's border. Negative values specify how many pixels are between the child and the right parent's border.20, -15

License

The MIT License.

Author

Wojciech Maj
kontakt@wojtekmaj.pl
http://wojtekmaj.pl

Keywords

FAQs

Package last updated on 03 Nov 2019

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