I tried modifying the plugin to show a modal popup when a website visitor leaves the page using haschange, but it still doesn't work. How to get it to work? I need help fixing it
$(document).ready(function(e) {
var exit_intent_popup_hash = 'b'
window.location.hash = exit_intent_popup_hash
window.history.back()
setTimeout(function() {
window.history.forward()
$('.fel-modal-parent-wrapper').each(function() {
var $this = $(this);
var tmp_id = $this.attr('id');
var popup_id = tmp_id.replace('-overlay', '');
var trigger_on = $this.data('trigger-on');
var exit_intent = $this.data('exit-intent');
if ('automatic' == trigger_on) {
if ('yes' == exit_intent && FelModalPopup_canShow(popup_id)) {
$(window).hashchange(function() {
if (window.location.hash !== `#${exit_intent_popup_hash}`) {
FelModalPopup_show(popup_id);
window.history.forward()
}
}, false);
}
}
});
}, 500);
});