6.1 KiB
Executable File
6.1 KiB
Executable File
普通页面层
捕获层
剔除默认标题栏
绑定弹层的拖拽元素
弹出任意自定义内容
弹出已经存在于页面中的一段元素
通常是放置在 <body> 根节点下
通常是放置在 <body> 根节点下
任意 HTML 内容
'
});
},
'test-page-wrap': function(){
layer.open({
type: 1,
shade: false, // 不显示遮罩
content: $('#ID-test-layer-wrapper'), // 捕获的元素
end: function(){
// layer.msg('关闭后的回调', {icon:6});
}
});
},
'test-page-title': function(){
layer.open({
type: 1,
area: ['420px', '240px'], // 宽高
title: false, // 不显示标题栏
closeBtn: 0,
shadeClose: true, // 点击遮罩关闭层
content: '任意 HTML 内容。可点击遮罩区域关闭。
'
});
},
'test-page-move': function(){
layer.open({
type: 1,
area: ['420px', '240px'], // 宽高
title: false,
content: ['',
'任意 HTML 内容',
'
'].join(''),
move: '#ID-test-layer-move'
});
},
'test-page-custom': function(){
layer.open({
type: 1,
area: '350px',
resize: false,
shadeClose: true,
title: 'demo : layer + form',
content: `
`,
success: function(){
// 对弹层中的表单进行初始化渲染
form.render();
// 表单提交事件
form.on('submit(demo-login)', function(data){
var field = data.field; // 获取表单字段值
// 显示填写结果,仅作演示用
layer.alert(JSON.stringify(field), {
title: '当前填写的字段值'
});
// 此处可执行 Ajax 等操作
// …
return false; // 阻止默认 form 跳转
});
}
});
}
})
});
</script>
',
'拖拽此处移动弹层',
'
',
'