bootstrap-modal
bootstrap-modal copied to clipboard
Modal options lost after re-opening
Initialize a modal with custom options:
jQuery('#ModalLogin').modal({'backdrop':'static','keyboard':true,'show':false});
Open it, close it. Everything works as expected. But when you will reopen it bootstrap-modal will reopen it with its default options. After digging into your code I found out that in "bootstrap-modalmanager.js" on line 233 you remove the container of the modal which also holds the dom-object of the modal. With this action the concated data (and options) of the modal will also be destroyed.
How to overcome this issue? Any ideas?
My latest commit destroyed modals on hide which was initially by design to help manage multiple open modals. Obviously that introduced a couple bugs so I will try to get a fix going ASAP.
For a temporary workaround you can use the html data api to set the options:
<div class="modal" data-backdrop="static" data-keyboard="true"></div>
Could it be possible that this is also causing the 'shown' event to not fire on the subsequent re-opening?
Unfortunately yes it is related, there are a couple open issues to address this as well. A fix should resolve these issues.