Wednesday, 21 August 2013

Bootstrap Modal bindinghandler not working with the backdrop

Bootstrap Modal bindinghandler not working with the backdrop

I'm trying to disable the backdrop from closing the modal when clicked
with the following:
ko.bindingHandlers.showModal = {
init: function (element, valueAccessor) {
},
update: function (element, valueAccessor) {
var value = valueAccessor();
if (ko.utils.unwrapObservable(value)) {
$(element).modal({ backdrop: 'static', keyboard: true });
// this is to focus input field inside dialog
$("input", element).focus();
}
else {
$(element).modal('hide');
}
}
};
However clicking on the backdrop still closes the modal, and in fact
breaks the "show" button. What am I doing wrong?
Fiddle: http://jsfiddle.net/PTSkR/175/

No comments:

Post a Comment