diff --git a/modal.js b/modal.js index 4462d51..c18cd54 100644 --- a/modal.js +++ b/modal.js @@ -10,24 +10,32 @@ class Modal extends IgniteElement { return { dialogClasses: null, modal: null, - modalInstance: null + modalInstance: null, + backdropClose: true }; } render() { return this.template.child( - new div().class("modal").ref(this.modal).child( - new div().class("modal-dialog").class(this.dialogClasses).child( - new div().class("modal-content").child( - new slot(this) - ) + new div() + .class("modal") + .data("backdrop", this.backdropClose, (value) => !value ? "static" : null) + .ref(this.modal) + .child( + new div() + .class("modal-dialog") + .class(this.dialogClasses) + .child( + new div().class("modal-content").child( + new slot(this) + ) + ) ) - ) ) } ready() { - this.modalInstance = new bootstrap.Modal(this.modal); + this.modalInstance = new bootstrap.Modal(this.modal, { backdrop: this.backdropClose ? "true" : "static" }); } show() {