Exit intent for popups

Useful for creating exit-intent style popups

setTimeout(() => {
document.addEventListener("mouseout", evt => {
if(evt.toElement === null && evt.relatedTarget === null) {
// An intent to exit has happened
}
});
}, 5000);

Original #

https://www.thepolyglotdeveloper.com/2018/11/using-exit-intent-listener-manage-popups-page/