bootstrap-modal icon indicating copy to clipboard operation
bootstrap-modal copied to clipboard

Modal options lost after re-opening

Open akger1379 opened this issue 11 years ago • 3 comments
trafficstars

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?

akger1379 avatar Jan 28 '14 12:01 akger1379

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>

jschr avatar Jan 28 '14 14:01 jschr

Could it be possible that this is also causing the 'shown' event to not fire on the subsequent re-opening?

alexhayes avatar Jan 28 '14 21:01 alexhayes

Unfortunately yes it is related, there are a couple open issues to address this as well. A fix should resolve these issues.

jschr avatar Jan 28 '14 21:01 jschr