Bounce
Simple module to show elements if it appears that user is leaving the page.
Installation
npm install @firstandthird/bounce
Usage
JavaScript
import '@firstandthird/bounce'
HTML
...
<body>
<div id="modal" data-bounce>
<div class="overlay" data-bounce-close></div>
<div class="modal">
<div class="modal-title">
<h3>Modal's Title</h3>
</div>
<div class="modal-body">
Modal's body
</div>
</div>
</div>
</body>
</html>
See the complete example.