...
|
...
|
@@ -83,8 +83,9 @@ toast.prototype.init = function(options) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
__self.dom.wrap.on('click', '[data-id]', function(event) {
|
|
|
// mod by xueyin: 修改事件实现
|
|
|
// __self.dom.wrap.on('click', '[data-id]', function(event) {
|
|
|
__self.dom.wrap.find('.modal-content').on('click', '[data-id]', function(event) {
|
|
|
var $this = $(this);
|
|
|
if (!$this.attr('disabled')) {
|
|
|
__self._trigger($this.data('id'));
|
...
|
...
|
@@ -92,6 +93,17 @@ toast.prototype.init = function(options) { |
|
|
event.preventDefault();
|
|
|
});
|
|
|
|
|
|
// mod by xueyin: 对话框上的事件不需要冒泡
|
|
|
$(document).on('click', '.modal-content', function(event) {
|
|
|
event.stopPropagation();
|
|
|
});
|
|
|
|
|
|
// add by xueyin: 增加点击背影关闭对话框功能
|
|
|
if (_o.backdrop == true) {
|
|
|
$(document).on('click', '.modal', function(event) {
|
|
|
__self.close();
|
|
|
});
|
|
|
}
|
|
|
return __self;
|
|
|
};
|
|
|
toast.prototype.addclass = function(css) {
|
...
|
...
|
@@ -160,9 +172,11 @@ toast.prototype.time = function(second) { |
|
|
};
|
|
|
toast.prototype.zIndex = function () {
|
|
|
var __self = this, _o = __self.options;
|
|
|
var index = _o.zIndex++;
|
|
|
__self.dom.wrap.css('zIndex', index);
|
|
|
__self.dom.backdrop.css('zIndex', index - 1);
|
|
|
// mod by xueyin 修改zindex,将对话框放到最上层
|
|
|
var index = _o.zIndex + 2;
|
|
|
__self.dom.wrap.find('.modal-content').css('zIndex', index);
|
|
|
__self.dom.wrap.css('zIndex', index - 1);
|
|
|
__self.dom.backdrop.css('zIndex', index - 2);
|
|
|
_o.zIndex = index;
|
|
|
return __self;
|
|
|
};
|
...
|
...
|
@@ -181,6 +195,13 @@ toast.prototype.close = function() { |
|
|
var __self = this,
|
|
|
_o = __self.options;
|
|
|
|
|
|
// add by xueyin: 关闭所注册过的事件
|
|
|
$(document).off('click', '.modal-content');
|
|
|
|
|
|
if (_o.backdrop == true) {
|
|
|
$(document).off('click', '.modal');
|
|
|
}
|
|
|
|
|
|
if (!__self.destroyed && __self.open) {
|
|
|
__self.dom.wrap.removeClass('in');
|
|
|
setTimeout(function() {
|
...
|
...
|
@@ -248,12 +269,14 @@ toast._through = function() { |
|
|
return api;
|
|
|
};
|
|
|
toast.open = function(options, callback) {
|
|
|
return this._through({
|
|
|
title: options.title,
|
|
|
addClass: options.addClass,
|
|
|
width: options.width,
|
|
|
content: options.content
|
|
|
});
|
|
|
// mod by xueyin: 这个参数传递很奇怪,不全,修改之
|
|
|
// return this._through({
|
|
|
// title: options.title,
|
|
|
// addClass: options.addClass,
|
|
|
// width: options.width,
|
|
|
// content: options.content
|
|
|
// });
|
|
|
return this._through(options);
|
|
|
}
|
|
|
toast.alert = function(content, callback) {
|
|
|
var __self = this,
|
...
|
...
|
|