浏览代码

Improving

Dante 12 年之前
父节点
当前提交
dcdd39527d
共有 1 个文件被更改,包括 10 次插入14 次删除
  1. 10 14
      js/bootstrap-dialog.js

+ 10 - 14
js/bootstrap-dialog.js

@@ -112,7 +112,6 @@ var BootstrapDialog = null;
         createModal: function() {
             var $modal = $('<div class="modal fade" tabindex="-1"></div>');
             $modal.prop('id', this.getId());
-            this.updateModalBackdrop($modal);
 
             return $modal;
         },
@@ -124,19 +123,6 @@ var BootstrapDialog = null;
 
             return this;
         },
-        updateModalBackdrop: function($modal) {
-            // Backdrop, I did't find a way to change bs3 backdrop option after the dialog is popped up, so here's a new wheel.
-            $modal.on('click', {dialog: this}, function(event) {
-                event.target === this && event.data.dialog.isClosable() && event.data.dialog.close();
-            });
-
-            // ESC key support
-            $modal.on('keyup', {dialog: this}, function(event) {
-                event.which === 27 && event.data.dialog.isClosable() && event.data.dialog.close();
-            });
-
-            return this;
-        },
         createModalDialog: function() {
             return $('<div class="modal-dialog"></div>');
         },
@@ -613,6 +599,16 @@ var BootstrapDialog = null;
                 dialog.showPageScrollBar(false);
             });
 
+            // Backdrop, I did't find a way to change bs3 backdrop option after the dialog is popped up, so here's a new wheel.
+            this.getModal().on('click', {dialog: this}, function(event) {
+                event.target === this && event.data.dialog.isClosable() && event.data.dialog.close();
+            });
+
+            // ESC key support
+            this.getModal().on('keyup', {dialog: this}, function(event) {
+                event.which === 27 && event.data.dialog.isClosable() && event.data.dialog.close();
+            });
+
             return this;
         },
         showPageScrollBar: function(show) {