Monitor an HTMLElement to be notified when it is visible
Name | Type | Description | Status | Default |
---|---|---|---|---|
elm | { HTMLElement } | The element to monitor | required | |
cb | { Function } | An optional callback to call when the element is visible | optional | null |
Return { (Promise) } The promise that will be resolved when the element is visible
import whenVisible from 'coffeekraken-sugar/js/dom/whenVisible'
whenVisible(myCoolHTMLElement).then((elm) => {
// do something with your element that is now visible
});
Author : Olivier Bossel [email protected] https://olivierbossel.com