1.0.6 • Published 5 years ago

predator v1.0.6

Weekly downloads
64
License
-
Repository
github
Last release
5 years ago

predator

Finds the exposed box, if there is one, of a child DOM element.

Useful if you want to check if an element is visible to the user, and how much of it.

Usage

npm install predator

Then:

var predator = require('predator');

var box = predator(someElement);

->

{
    top: offset from top of screen
    left: offset from left of screen
    right: right edge offset from left of screen
    bottom: bottom edge offset from top of screen
    height: height of the exposed region
    width: width of the exposed region
    hidden: true if the element is completely obscured from view
    original: the original result of child.getBoundingClientRect()
}

Performance

predator should be fast enough to use in a render loop, even on mobile devices.

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

7 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago