anseki / jquery-plainmodal

The simple jQuery Plugin for fully customizable modal windows.
http://anseki.github.io/jquery-plainmodal/
MIT License
78 stars 11 forks source link

Options to deactivate close on esc and click outside the modal #2

Closed sebastianlacuesta closed 9 years ago

sebastianlacuesta commented 9 years ago

It would be nice to have options to deactivate close on esc and outside the modal box.

anseki commented 9 years ago

Hi sebastián. "outside the modal box" does mean clicking the overlay? That is, do you want to ignore user's operation to close the modal?

sebastianlacuesta commented 9 years ago

Hi anseki. Can be seen this way. I'd like to perform some ajax actions and I don't want to let the user close the modal while this happens. Also it would be nice to close the modal only programmatically.

anseki commented 9 years ago

Ok, I understood. I think that you want the Loading. Can plainOverlay help you? It seems like the overlay of plainModal that doesn't accept user's operations, and you can show to user any messages or images.

sebastianlacuesta commented 9 years ago

No, in fact I want multiple user operation inside the modal. In my particular case, when I do an ajax, I don't want the modal to be closed. When the ajax operation has been performed, or if it's taking to much time, I'd like to restore the Esc key. I've just tried plainOverlay, but all I got to show is a graphical spinner. PlainModal does exactly what I want, a modal where first I ask the user to do something (or cancell, and thus esc key is allowed), then I perform the operation (here is where I'd like to deactivate the use of esc), and finally I show the result of the operation (and esc key again is allowed).

anseki commented 9 years ago

That is, do you want to cancel closing event and not cancel it? Does that like this sample? http://jsfiddle.net/maoqwv96/embedded/result/

sebastianlacuesta commented 9 years ago

Exactly. That's the behavior I'm looking for. I'll look better at the code of the fiddle as soon as I have more time. Thanks. Have a happy new year!

anseki commented 9 years ago

:smiley: A happy new year to you!

sebastianlacuesta commented 9 years ago

Works like a charm. Thanks!

anseki commented 9 years ago

:thumbsup: I close the issue.