BootstrapDialog的简单封装
类似alert的提示弹出框
$.dialogShow = function (msg,callBack,title) { if(typeof title == "undefined"){ title = '警告'; } BootstrapDialog.show({ title: title, type: BootstrapDialog.TYPE_WARNING, size: BootstrapDialog.SIZE_SMALL, realized:false, message: msg, buttons: [{ label: '确定', cssClass: 'btn-warning btn-sm', action: function (dialogItself) { dialogItself.close(); if (typeof callBack != "undefined"){ callBack.call(); } } }] }); return false; };
确认框
$.dialogConfirm = function(msg,okCallBack,title){ if(typeof title == "undefined"){ title = '确认'; } BootstrapDialog.confirm({ title : title, message : msg, type : BootstrapDialog.TYPE_WARNING, closable : true, //默认false,点击对话框以外的页面内容可关闭 draggable : true, //默认false,可拖拽 btnCancelLabel : '取消', //默认'Cancel', btnOKLabel : '确定', // 默认'OK', btnOKClass : 'btn-warning btn-sm', // 确定按钮的样式 size : BootstrapDialog.SIZE_SMALL, // 对话框关闭的时候执行方法 callback : function(result){ if (result){ okCallBack.call();//点击确定按钮,发起的调用事件 } } }); }
调用方式:
$.dialogConfirm("1222",function(){ $.dialogShow("success"); });