;(function($,window,document,undefined){ //默认参数 var params; var defaultparams = { title: "标题", content: "",btnl:"确定",btnr:"取消" , funl: new object, funr: new object }; $.dialogbyz = { //弹出提示框 alert: function (params) { show(params,"alert"); }, //弹出确认框 confirm: function (params) { show(params,"confirm"); }, //自动显示弹框 autofade: function (params) { show(params,"autofade") }, //关闭弹出框 close: function () { $(".zbox-popup,.zbox-popup-backdrop").remove(); }, //加载图形 loading:function(url){ loadbox(url) } }; //初始化参数 function init(params) { if (params != undefined && params != null) { params = $.extend({},defaultparams, params); } }; function loadbox(url){ var url=url; var dislogcontainer=$('
'); var blackfilter=$('
'); settimeout(function(){ $(".zbox-popup").addclass('zbox-popup-in'); $(".zbox-popup-backdrop").addclass('zbox-active'); },30) //$("body").append(blackfilter); $("body").append(dislogcontainer); } function show(params, caller){ init(params); var dislogcontainer; var dialoginner; var dialogbtn; var blackfilter=$('
'); if(caller=='autofade'){ dislogcontainer=$('
' +params.content+'
'); $("body").append(dislogcontainer); settimeout(function(){ $(".zbox-toast-container").addclass('zbox-active'); },30) settimeout(function(){ $(".zbox-toast-container").remove(); },3000) }else{ dislogcontainer=$('
'); dialoginner=$('
'+params.title+'
'+params.content+'
'); dialogbtn=$('
'+params.btnl+'
'); if(caller=='confirm'){ dialogbtn.append($(''+params.btnr+'')); } dislogcontainer.append(dialoginner); dislogcontainer.append(dialogbtn); settimeout(function(){ $(".zbox-popup").addclass('zbox-popup-in'); $(".zbox-popup-backdrop").addclass('zbox-active'); },10) $("body").append(blackfilter); $("body").append(dislogcontainer); $(".zbox-popup-button").click(function(){ var indexs=$(this).attr('index'); if(indexs==0){ //左侧按钮 if($.isfunction(params.funl)){ params.funl(); }else{ $.dialogbyz.close(); } }else{ //右侧按钮 if($.isfunction(params.funr)){ params.funr(); }else{ $.dialogbyz.close(); } } return false; }) } // } })(jquery,window,document);