detect-element-overflow

WebJar for detect-element-overflow

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

detect-element-overflow
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

detect-element-overflow
WebJar for detect-element-overflow
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/wojtekmaj/detect-element-overflow

Download detect-element-overflow

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/detect-element-overflow/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>detect-element-overflow</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/detect-element-overflow/
implementation 'org.webjars.npm:detect-element-overflow:1.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/detect-element-overflow/
implementation ("org.webjars.npm:detect-element-overflow:1.2.0")
'org.webjars.npm:detect-element-overflow:jar:1.2.0'
<dependency org="org.webjars.npm" name="detect-element-overflow" rev="1.2.0">
  <artifact name="detect-element-overflow" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='detect-element-overflow', version='1.2.0')
)
libraryDependencies += "org.webjars.npm" % "detect-element-overflow" % "1.2.0"
[org.webjars.npm/detect-element-overflow "1.2.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

npm downloads CI 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 name Description Example values
collidedTop Whether or not the child element collided with the top parent's border. true
collidedBottom Whether or not the child element collided with the bottom parent's border. true
collidedLeft Whether or not the child element collided with the left parent's border. true
collidedRight Whether or not the child element collided with the right parent's border. true
overflowTop How many pixels of the child have crossed the top parent's border. Negative values specify how many pixels are between the child and the top parent's border. 20, -15
overflowBottom How many pixels of the child have crossed the bottom parent's border. Negative values specify how many pixels are between the child and the bottom parent's border. 20, -15
overflowLeft How many pixels of the child have crossed the left parent's border. Negative values specify how many pixels are between the child and the left parent's border. 20, -15
overflowRight How many pixels of the child have crossed the 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
[email protected]
http://wojtekmaj.pl

Versions

Version
1.2.0