天天看点

js layui 弹出子窗体_Layui中JS实现弹出层的应用

点我

//弹出一个页面层

var oBtn = document.getElementById('tab_1');

oBtn.onclick = function (){

layer.open({

type: 1,

area: ['500px', '360px'],

shadeClose: true, //点击遮罩关闭

content: '\自定义内容',

btn: ['确定', '取消'],

yes: function(index, layero) {

layer.msg('已确定');

},

btn2: function(index, layero) {

layer.msg('已取消');

return false //开启该代码可禁止点击该按钮关闭

}

});

layer.open({

type: 2,

skin: 'layui-layer-demo', //样式类名

title: '标题',

closeBtn: 0, //不显示关闭按钮

anim: 2,

area: ['893px', '600px'],

shadeClose: true, //开启遮罩关闭

content: '。。。。.html'

});

这是layui弹出层的代码,其中,type属性表示弹出层的类型,type为1 ,content显示的是纯文本内容,type为2,content为跳转页面

}

继续阅读