Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ddofborg opened this issue Sep 25, 2024 · 0 comments

Comments

@ddofborg
Copy link

ddofborg commented Sep 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant