Prevent double opening popup

[MAILPOET-3057]
This commit is contained in:
Pavel Dohnal
2020-09-03 12:38:36 +02:00
committed by Veljko V
parent 81a37be18f
commit 3616bbe490

View File

@@ -90,7 +90,8 @@ jQuery(($) => {
if (Number.isNaN(delay)) {
delay = 0;
}
setTimeout(() => {
const timeout = setTimeout(() => {
$(document).off('mouseleave');
doDisplayForm(formDiv, showOverlay);
}, delay * 1000);
@@ -99,6 +100,7 @@ jQuery(($) => {
$(document).on('mouseleave', () => {
doDisplayForm(formDiv, showOverlay);
$(document).off('mouseleave');
clearTimeout(timeout);
});
}
}