/************************ Layer扩展 ****************************/ /* * Layer弹出Alert提示框 * @param message 提示信息 * @param type 类型 1成功 2失败 3疑问 7提示 * @param fn (可选)点击后回调方法 * @return */ function LayerAlert(message, type, fn) { layer.alert(message, { icon: type }, fn); } /* * Layer弹出Confirm提示框 * @param message 确认提示信息 * @param okfn 确认后回调 function (index) { alert("确认操作后回调,一般执行程序,完成后layer.close(index)关闭Layer"); } * @param errorfn (可选)取消操作后回调 function () { alert("取消操作后回调"); } * @return */ function LayerConfirm(message, okfn, cancelfn) { layer.confirm( message, { btn: ['确定', '取消'] }, okfn, cancelfn ); } /* * Layer弹出新窗口 * @param url 网址 * @param title 标题 * @param width 宽 * @param height 高 * @param closefn (可选)关闭后回调 function (index) { alert("关闭"); layer.close(index);} * @return */ function LayerOpen(url, title, width, height, closefn) { layer.open({ type: 2, title: title, shadeClose: false, //必须点弹窗关闭按钮关闭 shade: 0.5, area: [width, height], content: url, //让iframe出现滚动条content: ['http://www.xxx.com', 'no'] cancel: closefn }); } /* * Layer加载效果(自动关闭) * @param type 0-2加载效果 * @param minute 几秒钟后消失 * @return */ function LayerLoadAuto(type, second) { layer.load(type, { time: second * 1000, shade: 0.1 }); } /* * Layer加载效果 * @param type 0-2加载效果 * @return */ function LayerLoad(type) { var index = layer.load(type); return index; } /* * Layer关闭 * @param index 打开的index * @return */ function LayerClose(index) { layer.close(index); }