layer 模态窗口基本问题

        Bootstap插件里面的  layer,里面有好多基础的参数,供大家进行参考、  感觉挺好有的 可以以下地址的 layer.api 进行学


网址如下:http://layer.layui.com/api.html#type


layer.oper({

   type:2,

    title:'"test",

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

 closeBtn: 0,

shadeClose: true,

content: "hello world"

});

要关闭 layui 的子窗口,你可以使用 `layer.close(index)` 方法,其中 `index` 是子窗口的索引值。 下面是一个示例代码,演示如何关闭 layui 的子窗口: ```html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>关闭 layui 子窗口示例</title> <link rel="stylesheet" href="https://cdn.staticfile.org/layui/2.5.6/css/layui.css"> </head> <body> <!-- 主页面内容 --> <div class="layui-container"> <button class="layui-btn" onclick="openChildWindow()">打开子窗口</button> </div> <!-- 子窗口模板 --> <script type="text/html" id="childWindowTemplate"> <div class="layui-layer-content"> <h2>子窗口内容</h2> <button class="layui-btn layui-btn-sm layui-btn-danger" onclick="closeChildWindow()">关闭子窗口</button> </div> </script> <script src="https://cdn.staticfile.org/layui/2.5.6/layui.js"></script> <script> // 打开子窗口 function openChildWindow() { var childWindowIndex = layer.open({ type: 1, title: '子窗口', content: $('#childWindowTemplate').html(), area: ['400px', '300px'] }); } // 关闭子窗口 function closeChildWindow() { layer.closeAll(); } </script> </body> </html> ``` 在上面的示例代码中,点击 "打开子窗口" 按钮会弹出一个 layui 的子窗口。子窗口中有一个 "关闭子窗口" 按钮,点击该按钮会调用 `closeChildWindow()` 函数来关闭子窗口。 当调用 `layer.closeAll()` 方法时,会关闭所有的 layui 弹窗,包括子窗口和主窗口。如果你只想关闭特定的子窗口,可以使用 `layer.close(index)` 方法,其中 `index` 是子窗口的索引值。你可以在打开子窗口时记录子窗口的索引值,并在需要关闭子窗口时使用该索引值来关闭指定的子窗口
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值