layui自定义dom弹框

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./layui/css/layui.css">
    <script src="./jquery-1.11.2.min.js"></script>
    <script src="./layui/layui.all.js"></script>
    <style>
        .ydool-open-content .ydool-open-title {
            font-size: 16px;
            text-align: center;
            color: #333333;
            line-height: 20px;
            margin-top: 24px;
            margin-bottom: 8px;
            font-weight: bold;
        }
        .ydool-open-content .ydool-open-p {
            font-size: 14px;
            text-align: center;
            color: #999999;
            line-height: 20px;
            padding: 0 24px;
            margin-bottom: 20px;
        }
        /* 以skin的自定义类名写的样式 */
        .custombox.layui-layer-page .layui-layer-btn {
            padding: 0;
            display: flex;
            border-top: 1px solid #ebedf0;
        }
        .custombox.layui-layer-page .layui-layer-btn a {
            margin: 0;
            flex: 1;
            text-align: center;
            height: 48px;
            line-height: 48px;
            border: none;
            color: #666666;
            font-size: 16px;
            padding: 0;
        }
        .custombox.layui-layer-page .layui-layer-btn a.layui-layer-btn0 {
            color: #195fe3;
            background-color: #ffffff;
            border-right: 1px solid #ebedf0;
        }
    </style>
</head>

<body>
    <button id="btn">我是测试按钮</button>
    <script type="text/html" id="ydool-if">
        <div class="ydool-open-content">
            <h4  class="ydool-open-title">提示</h4>
            <p class="ydool-open-p">是否退出当前账号?</p>
        </div>
    </script>
    <script>
        $('#btn').on('click', function () {
            var reject = document.getElementById('ydool-if').innerHTML;
            layer.open({
                type: 1,
                title: false,
                closeBtn: 0,
                area: ['310px'],
                shadeClose: true,  //false-点击弹出层外不能关闭
                // skin: 'ydool-openIf',  //自定义样式类名
                skin: 'custombox',
                content: reject
                , btn: ['确 定', '取 消']
                , yes: function (index) {
                    layer.close(index);
                }
            });
        })
    </script>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值