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

Is it possible to stop clicks outside the modal closing it ? #9

Closed cretace closed 7 years ago

cretace commented 7 years ago

Is it possible to stop clicks outside the modal closing it ? I would like to only allow clicks on my save / cancel buttons to dismiss the modal

anseki commented 7 years ago

Hi @cretace,

You can cancel the closing the modal window in plainmodalbeforeclose evnet.

cretace commented 7 years ago

Ok, but can I detect if the click is on the overlay and not the modal ?

cretace commented 7 years ago

It's ok I figured it out - set a value on clicks Thanks

anseki commented 7 years ago

Yes, you can hook a click event of the overlay and cancel it, but it's not smart because your code should do something when the button is clicked. e.g.: When the "Save" button is clicked, your code checks "File Name", and set true to isOk.

cretace commented 7 years ago

I have validation on the form fields so it's all covered - plus a 'cancel' button to dismiss the modal. It was a mistake to put this form in a modal - but I'm not the designer!

anseki commented 7 years ago

So, at least this issue seems to have been solved, and I close it.