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

  1. $elm*-HTMLElement

    The element to monitor

  2. settings{}Partial<TWhenOutOfViewportSettings>

    Some settings to tweak the detection behavior

Return

  1. -(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

  1. offset10pxString

    An offset to detect sooner or later the element exits the viewport

Todo

  • testsnormal