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('
' + msg.title + '' + msg.text + '
');
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('' + msg.title + '' + msg.text + '
');
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;
}