|
@@ -83,8 +83,9 @@ toast.prototype.init = function(options) { |
|
@@ -83,8 +83,9 @@ toast.prototype.init = function(options) { |
83
|
});
|
83
|
});
|
84
|
}
|
84
|
}
|
85
|
|
85
|
|
86
|
-
|
|
|
87
|
- __self.dom.wrap.on('click', '[data-id]', function(event) {
|
86
|
+ // mod by xueyin: 修改事件实现
|
|
|
87
|
+ // __self.dom.wrap.on('click', '[data-id]', function(event) {
|
|
|
88
|
+ __self.dom.wrap.find('.modal-content').on('click', '[data-id]', function(event) {
|
88
|
var $this = $(this);
|
89
|
var $this = $(this);
|
89
|
if (!$this.attr('disabled')) {
|
90
|
if (!$this.attr('disabled')) {
|
90
|
__self._trigger($this.data('id'));
|
91
|
__self._trigger($this.data('id'));
|
|
@@ -92,6 +93,17 @@ toast.prototype.init = function(options) { |
|
@@ -92,6 +93,17 @@ toast.prototype.init = function(options) { |
92
|
event.preventDefault();
|
93
|
event.preventDefault();
|
93
|
});
|
94
|
});
|
94
|
|
95
|
|
|
|
96
|
+ // mod by xueyin: 对话框上的事件不需要冒泡
|
|
|
97
|
+ $(document).on('click', '.modal-content', function(event) {
|
|
|
98
|
+ event.stopPropagation();
|
|
|
99
|
+ });
|
|
|
100
|
+
|
|
|
101
|
+ // add by xueyin: 增加点击背影关闭对话框功能
|
|
|
102
|
+ if (_o.backdrop == true) {
|
|
|
103
|
+ $(document).on('click', '.modal', function(event) {
|
|
|
104
|
+ __self.close();
|
|
|
105
|
+ });
|
|
|
106
|
+ }
|
95
|
return __self;
|
107
|
return __self;
|
96
|
};
|
108
|
};
|
97
|
toast.prototype.addclass = function(css) {
|
109
|
toast.prototype.addclass = function(css) {
|
|
@@ -160,9 +172,11 @@ toast.prototype.time = function(second) { |
|
@@ -160,9 +172,11 @@ toast.prototype.time = function(second) { |
160
|
};
|
172
|
};
|
161
|
toast.prototype.zIndex = function () {
|
173
|
toast.prototype.zIndex = function () {
|
162
|
var __self = this, _o = __self.options;
|
174
|
var __self = this, _o = __self.options;
|
163
|
- var index = _o.zIndex++;
|
|
|
164
|
- __self.dom.wrap.css('zIndex', index);
|
|
|
165
|
- __self.dom.backdrop.css('zIndex', index - 1);
|
175
|
+ // mod by xueyin 修改zindex,将对话框放到最上层
|
|
|
176
|
+ var index = _o.zIndex + 2;
|
|
|
177
|
+ __self.dom.wrap.find('.modal-content').css('zIndex', index);
|
|
|
178
|
+ __self.dom.wrap.css('zIndex', index - 1);
|
|
|
179
|
+ __self.dom.backdrop.css('zIndex', index - 2);
|
166
|
_o.zIndex = index;
|
180
|
_o.zIndex = index;
|
167
|
return __self;
|
181
|
return __self;
|
168
|
};
|
182
|
};
|
|
@@ -181,6 +195,13 @@ toast.prototype.close = function() { |
|
@@ -181,6 +195,13 @@ toast.prototype.close = function() { |
181
|
var __self = this,
|
195
|
var __self = this,
|
182
|
_o = __self.options;
|
196
|
_o = __self.options;
|
183
|
|
197
|
|
|
|
198
|
+ // add by xueyin: 关闭所注册过的事件
|
|
|
199
|
+ $(document).off('click', '.modal-content');
|
|
|
200
|
+
|
|
|
201
|
+ if (_o.backdrop == true) {
|
|
|
202
|
+ $(document).off('click', '.modal');
|
|
|
203
|
+ }
|
|
|
204
|
+
|
184
|
if (!__self.destroyed && __self.open) {
|
205
|
if (!__self.destroyed && __self.open) {
|
185
|
__self.dom.wrap.removeClass('in');
|
206
|
__self.dom.wrap.removeClass('in');
|
186
|
setTimeout(function() {
|
207
|
setTimeout(function() {
|
|
@@ -248,12 +269,14 @@ toast._through = function() { |
|
@@ -248,12 +269,14 @@ toast._through = function() { |
248
|
return api;
|
269
|
return api;
|
249
|
};
|
270
|
};
|
250
|
toast.open = function(options, callback) {
|
271
|
toast.open = function(options, callback) {
|
251
|
- return this._through({
|
|
|
252
|
- title: options.title,
|
|
|
253
|
- addClass: options.addClass,
|
|
|
254
|
- width: options.width,
|
|
|
255
|
- content: options.content
|
|
|
256
|
- });
|
272
|
+ // mod by xueyin: 这个参数传递很奇怪,不全,修改之
|
|
|
273
|
+ // return this._through({
|
|
|
274
|
+ // title: options.title,
|
|
|
275
|
+ // addClass: options.addClass,
|
|
|
276
|
+ // width: options.width,
|
|
|
277
|
+ // content: options.content
|
|
|
278
|
+ // });
|
|
|
279
|
+ return this._through(options);
|
257
|
}
|
280
|
}
|
258
|
toast.alert = function(content, callback) {
|
281
|
toast.alert = function(content, callback) {
|
259
|
var __self = this,
|
282
|
var __self = this,
|