I am looking for something like this, which based on condition stops the popup to show. But this does not work.
HTML:
<a href="#modal" rel="modal:open">show modal</a>
JS:
condition = -1;
$(document).on( $.modal.BEFORE_BLOCK, function(event, modal) {
if( condition > 0 ) {
// open the modal
} else {
// do not open the modal
alert('condition is below 0');
return false;
}
});
I know as a work around I could like use a click event on the button and open the modal manually. But I would expect there should be a way to present the event to propagate. But it doesn't work...