saribe / eModal

Easy Modal for bootstrap, is a simple way to create modal dialogs using javascript.
http://saribe.github.io/eModal
271 stars 97 forks source link

Prevent Modal to close when clicking outside the Modal #47

Closed Sharj closed 8 years ago

Sharj commented 8 years ago

Prevent modal to close when clicking outside the modal or by pressing 'Q' on the keyboard by introducing a new option property.

The above behaviour can be achieved by adding following attributes to the main div.modal 'data-backdrop="static" data-keyboard="false" ' - It can also be archived by JS

I introduced a new option and tried to add 'data-backdrop' in div.modal '_getMessage(data)' function but it didn't quite work yet. What would be the best way to add prevent-close modal?

saribe commented 8 years ago

You can use eModal.setModalOptions(params) to set that behaiviour.

Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-backdrop="".

Take a look: http://getbootstrap.com/javascript/#via-javascript