onmount
Version:
Run something when a DOM element appears and when it exits
12 lines (8 loc) • 312 B
Markdown
# Cancelling
You can cancel an initialization by returning `false`. This makes it so that the initialization will run again when `init` is triggered again. This is also available for exit callbacks.
```js
$.onmount('.expandable-nav', function () {
if ($(this).is(':hidden')) return false
/* ... */
})
```