I have 2 popups on my website, 1st popup comes after 3 sec of page load, and 2nd popup comes when the user tries to leave the website. all things work fine. But when the user tries to fill the form from 1st popup auto suggestions come for input, when the user hovers over the auto-suggestion the exit intent popup comes, which is making a bad user experience. I don't want to close autosuggestion because it makes it easy for users to fill out forms fast. I'm trying to disable another popup till 1st popup is visible
What I have tried:
Below is an exit intent popup code
var c, a = window.location.pathname,
d = a.substring(a.lastIndexOf("/") + 1);
if (d !== "thank-you.php") {
function addEvent(obj, evt, fn) {
if (obj.addEventListener) {
obj.addEventListener(evt, fn, false);
} else if (obj.attachEvent) {
obj.attachEvent("on" + evt, fn);
}
}
addEvent(document, 'mouseout', function(evt) {
if (evt.toElement == null && evt.relatedTarget == null) {
if(sessionStorage["PopupShown"] != 'yes'){
sessionStorage["PopupShown"] = 'yes';
$('.lightbox').modal('show');
$('#enqModal').modal('hide');
}
};
});
Below is the code in which I'm trying to disable the exit popup while 1st popup is visible
let m = document.querySelector("#enqModal").style.display;
if(m === 'block'){
$('.lightbox').modal('hide');
}
please guide, how can i make this possible