如何实现一个自定义的弹出框

.ewb-mesgbox {
    position: relative;
    width: 500px;
    background-color: #fff;
}

.ewb-msgbox-hd {
    height: 60px;
    line-height: 60px;
    text-align: center;
    font-size: 20px;
    background-color: #f5f5f5;
}

.ewb-colse {
    display: block;
    width: 14px;
    height: 14px;
    font-size: 14px;
    color: #999;
    position: absolute;
    right: 15px;
    top: 15px;
    z-index: 9999;
    cursor: pointer;
    background: url(../images/close_btn.png) center center no-repeat;
}

.ewb-msgbox-notice {
    height: 140px;
    line-height: 140px;
    font-size: 16px;
    color: #104382;
    text-align: center;
}

.ewb-msgbox-bd2 {
    padding: 34px 0;
}

.ewb-msgbox-notice2 {
    font-size: 16px;
    color: #104382;
    text-align: center;
    line-height: 24px;
}

然后创建一个在html文件中去新增一个模板:

    <script type="text/x-template" id="msgbox">
        <div class="ewb-mesgbox">
            <span class="ewb-colse"></span>
            <div class="ewb-msgbox-hd">提示</div>
            <div class="ewb-msgbox-bd">
                <p class="ewb-msgbox-notice">对不起,........!</p>
            </div>
        </div>
    </script>

我们在页面中引入layer插件

  open($('#msgbox'));

就可以弹出比较好看的框:

希望对你有所帮助

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值