shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
whenOutOfViewport
Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.dom.when
Monitor an HTMLElement to be notified when it exit the viewport
Params
- $elm*-HTMLElement
The element to monitor
- settings{}Partial<TWhenOutOfViewportSettings>
Some settings to tweak the detection behavior
Return
- -(Promise<HTMLElement>)
The promise that will be resolved when the element exit the viewport
Example
import { whenOutOfViewport } from '@blackbyte/sugar/dom'
whenOutOfViewport($myCoolHTMLElement).then(($elm) => {
// do something with your element that has exit the viewport...
});Settings
- offset10pxString
An offset to detect sooner or later the element exits the viewport
Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space