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

Prevent closing modal on clicking outside of modal (anywhere on the body) #16

Closed
creativesoumik opened this issue May 21, 2014 · 4 comments
Labels

Comments

@creativesoumik
Copy link

is there any way to prevent closing the modal by clicking on outside of the modal? i want the user to click on the close button in order to close the modal.

@vodkabears
Copy link
Owner

If you really need it, try this:

$(document).ready(function () {
    $('.remodal-overlay').unbind('click.remodal');
});

@martinpesout
Copy link

If you are removing click-outside event, you need to remove also ESC keypress event to prevent closing window. You can do that by:

$(document).unbind('keyup.remodal'); // unbind ESC keypress

@vodkabears
Copy link
Owner

@martinpesout yep.

@damiani
Copy link

damiani commented Jan 15, 2016

Note that both of these bindings have changed; since version 1.0.2, they should be:

$(document).ready(function () {
    $('.remodal-wrapper').unbind('click.remodal');
});

and

$(document).unbind('keydown.remodal');

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

No branches or pull requests

4 participants