MCPcopy
hub / github.com/formkit/auto-animate / isOffscreen

Function isOffscreen

src/index.ts:134–139  ·  view source on GitHub ↗

* Determine if an element is fully outside of the current viewport. * @param el - Element to test

(el: Element)

Source from the content-addressed store, hash-verified

132 * @param el - Element to test
133 */
134function isOffscreen(el: Element): boolean {
135 const rect = (el as HTMLElement).getBoundingClientRect()
136 const vw = root?.clientWidth || 0
137 const vh = root?.clientHeight || 0
138 return rect.bottom < 0 || rect.top > vh || rect.right < 0 || rect.left > vw
139}
140
141/**
142 * Observe this elements position.

Callers 2

remainFunction · 0.85
addFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…