function confirmMsgnew(params) {
|
var msg = null;
|
|
msg = {
|
text: params.text ? params.text : '您确定要这样操作吗?',
|
title: params.title ? params.title : '提示信息',
|
style: params.style ? ' popmsg-' + params.style : '',
|
btnCloseStyle: params.style ? ' btn-' + params.style : '',
|
autoClose: params.autoClose == true ? true : false,
|
draggable: params.drag == true ? true : false,
|
|
init: function () {
|
$(document.body).append('<div class="confirm-msg"><div class="shade"></div><div class="popmsg' + msg.style + '"><span class="popmsg-title"><i class="fa fa-info-circle"></i>' + msg.title + '</span><span class="popmsg-content">' + msg.text + '</span><span class="popmsg-close"><button class="btn mr5 btn-close-yes' + msg.btnCloseStyle + '">Yes</button><button class="btn btn-close-no' + msg.btnCloseStyle + '">No</button></span></div></div>');
|
document.onmousewheel = function () { return false; }
|
msg.resizeDialog();
|
$(window).resize(function () { msg.resizeDialog(); });
|
msg.dragDialog();
|
msg.callDialog();
|
},
|
|
resizeDialog: function () {
|
$('.popmsg').css({ top: ($(window).height() - $('.popmsg').height()) / 2 + 'px', left: ($(window).width() - $('.popmsg').width()) / 2 + 'px' });
|
},
|
|
closeDialog: function () {
|
$('.confirm-msg').remove();
|
document.onmousewheel = function () { return true; }
|
},
|
|
dragDialog: function () {
|
if (msg.draggable) { $('.popmsg').draggable({ cursor: "move" }); }
|
},
|
|
callDialog: function () {
|
$('.btn.btn-close-yes').click(function () {
|
msg.closeDialog();
|
if (typeof params.callback == 'function') { params.callback(); }
|
});
|
$('.btn.btn-close-no').click(function () {
|
msg.closeDialog();
|
});
|
}
|
}
|
|
return msg;
|
}
|
|
function alertMsg(params) {
|
var msg = null;
|
|
msg = {
|
text: params.text ? params.text : '这家伙很懒,提示的什么内容也不写。',
|
title: params.title ? params.title : '提示信息',
|
style: params.style ? ' popmsg-' + params.style : '',
|
btnCloseStyle: params.style ? ' btn-' + params.style : '',
|
autoClose: params.autoClose == true ? true : false,
|
draggable: params.drag == true ? true : false,
|
|
init: function () {
|
$(document.body).append('<div class="alert-msg"><div class="shade"></div><div class="popmsg' + msg.style + '"><span class="popmsg-title"><i class="fa fa-info-circle"></i>' + msg.title + '</span><span class="popmsg-content">' + msg.text + '</span><span class="popmsg-close"><button class="btn btn-close-alert' + msg.btnCloseStyle + '">Close</button></span></div></div>');
|
document.onmousewheel = function () { return false; }
|
msg.resizeDialog();
|
$(window).resize(function () { msg.resizeDialog(); });
|
msg.dragDialog();
|
msg.closeDialog();
|
},
|
|
resizeDialog: function () {
|
$('.popmsg').css({ top: ($(window).height() - $('.popmsg').height()) / 2 + 'px', left: ($(window).width() - $('.popmsg').width()) / 2 + 'px' });
|
},
|
|
closeDialog: function () {
|
if (msg.autoClose) {
|
setTimeout(function () {
|
$('.alert-msg').remove();
|
}, 3000);
|
} else {
|
$('.btn.btn-close-alert').click(function () {
|
$('.alert-msg').remove();
|
if (typeof params.callback == 'function') { params.callback(); }
|
});
|
}
|
|
document.onmousewheel = function () { return true; }
|
},
|
|
dragDialog: function () {
|
if (msg.draggable) { $('.popmsg').draggable({ cursor: "move" }); }
|
}
|
}
|
|
return msg;
|
}
|