Function: isInViewport()
ts
function isInViewport(element): boolean;Checks whether an element is within the viewport.
Parameters
| Parameter | Type | Description |
|---|---|---|
element | Element | The target element. |
Returns
boolean
true when the element intersects the viewport.
Example
ts
const el = document.createElement('div')
document.body.appendChild(el)
console.log(isInViewport(el))Since
1.0.0