1.引入jquery和layUI
<script type="text/javascript" src="http://libs.baidu.com/jquery/2.1.1/jquery.min.js"></script>
<script src="https://www.layuicdn.com/auto/layui.js" v="layui" e="layui"></script>
2.添加一个按钮或点击事件
<h1 id="open">弹框</h1>
<script>
$(function() {
layui.use(['form', 'layer'], function() {
var form = layui.form,
layer = layui.layer;
//id='open'点击事情
$("#open").click(function() {
layer.open({
type: 1,
//隐藏的div
content: $('#divOpen'),
title: '说明',
area: ['90%', '90%'],
fixed: false
// , resize: false
// , offset: '5%'
,
cancel: function(index, layero) {
//关闭所有弹出框
layer.closeAll();