If you are using jquery you can use this:
function isABootstrapModalOpen() {
return $('.modal.in').length > 0;
}
Vanilla JS Solution:
function isABootstrapModalOpen() {
return document.querySelectorAll('.modal.in').length > 0;
}
This solution works for any modal, not just specific.
Edit : the code above the test, if at any time the modal is open. As indicated in other answers, if you want to disable the event handler at the moment the modality is opened, you will have to use boot events, for example:
$('.modal').on('show.bs.modal', function (e) {
})
$('.modal').on('hide.bs.modal', function (e) {
})
isABootstrapModalOpen , , ( / / ).
function eventHandler(e) {
if(isABootstrapModalOpen()) {
e.preventDefault();
return;
}
}