If I call SimpleModal for the first time with an option such as {overlayClose: false}, how can I change that option to {overlayClose: true} later on?
I hope to open SimpleModal at the start of an AJAX call to provide the user some feedback while preventing the modal from being closed, then in the AJAX complete callback, set the modal to be closable.
Yes, but you have to change the option, then rebind the event handlers to see the option changes. I hacked this into the "basic" demo from the documentation site:
$('#basic-modal .basic').click(function (e) {
var modal = $('#basic-modal-content').modal();
$('#overclose').text(modal.o.overlayClose ? 'true' : 'false');
window.setTimeout(function() {
// These three lines will do it:
modal.o.overlayClose = true;
modal.unbindEvents();
modal.bindEvents();
$('#overclose').text('true');
}, 5000);
return false;
});
After 5 seconds, the option kicks in as you expected. I also hacked an indicator, a span id'd as "overclose", into the modal itself to show you the state and when it changes.