inViewport
Commons
stable
Returns true if a bounding box (IBox or DOMRect) is at least partially visible in the current viewport.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- elementrequiredIBox | DOMRect
- A bounding box with top, right, bottom, left properties. Typically obtained via element.getBoundingClientRect().
API
Return value
The value returned by this util.
- true when any part of the box is within the viewport boundaries; false otherwise.
Usage
Examples
Ready-to-paste usage snippets.
Check element visibility on scroll