exit-intent
Version:
Exit intent detection library.
57 lines (41 loc) • 1.52 kB
Markdown
[![version][version]](http://npm.im/exit-intent)
[![MIT License][MIT License]](http://opensource.org/licenses/MIT)
[![Standard][Standard]](http://standardjs.com)
[![Standard Version][Standard Version]](https://github.com/conventional-changelog/standard-version)
[![Size][Size]](https://unpkg.com/exit-intent)
[![Size gzip][Size gzip]](https://unpkg.com/exit-intent)
Exit Intent detection library.
```js
import exitIntent from 'exit-intent'
// Initialise
const removeExitIntent = exitIntent({
threshold: 50,
maxDisplays: 2,
eventThrottle: 100,
onExitIntent: () => {
console.log('exit-intent triggered')
}
})
// Destroy
removeExitIntent()
```
`threshold` (default 20)
maximum distance in pixels from the top of the page to trigger.
`maxDisplays` (default 1)
maximum number of times to trigger.
`eventThrottle` (default 200)
event throttle in milliseconds.
`onExitIntent` (default no-op function)
function to call when an exit intent has been detected.
MIT
[]: https://img.shields.io/npm/v/exit-intent.svg
[]: https://img.shields.io/npm/l/exit-intent.svg
[]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[]: https://img.shields.io/badge/release-standard%20version-brightgreen.svg
[]: https://badges.herokuapp.com/size/npm/exit-intent
[]: https://badges.herokuapp.com/size/npm/exit-intent?gzip=true
originally based on https://github.com/richriscunha/Exitent