Skip to content

Is there a way to stop the modal to appear using events based on some external condition (check) #314

@ddofborg

Description

@ddofborg

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions