封装弹框

css

/**--弹框--**/
.reg_suc {
    position: fixed;
    top: 0%;
    left: 0%;
    z-index: 999;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
}
.success {
    width: 80%;
    height: 11.25rem;
    z-index: 95;
    background: #fff;
    margin: 0 auto;
    margin-top: 50%;
    border-radius: 5px;
}
.reg {
    display: inline-block;
    width: 74px;
    height: 72px;
    background: url(../../images/reg.png) no-repeat;
    background-size: 117%;
    position: relative;
    left: 35%;
    top: 15px;
}
.warn {
    display: inline-block;
    width: 74px;
    height: 72px;
    background: url(../../images/warn.png) no-repeat;
    background-size: 95%;
    position: relative;
    left: 35%;
    top: 15px;
}
.fail {
    display: inline-block;
    width: 74px;
    height: 72px;
    background: url(../../images/fail.png) no-repeat;
    background-size: 95%;
    position: relative;
    left: 35%;
    top: 15px;
}
.success>p {
    text-align: center;
    padding-top: 10px;
    font-size: 1.375rem;
}
.success .tolog {
    background: #ffba00;
    width: 50%;
    height: 1.875rem;
    border-radius: 5px;
    margin-left: 23%;
    margin-top: 10px;
    text-align: center;
    line-height: 1.875rem;
}
.success .tolog a {
    color: #fff;
}
a {
    text-decoration: none;
}
.yq-footer-copyright {

    margin-bottom: 30px;
}

点击事件写外面会不执行,因为html为虚拟对象

function alterTan(className,msg,btn,load){
    $('body').append("<div class='reg_suc'><div class='success'><i class="+className+"></i><p>"+msg+"</p><div class='tolog' ><a href='javascript:void(0);' >"+btn+"</a></div></div></div>");
    $(".tolog").bind('click',function(){ //等html元素加载完后再获取dom对象添加点击事件
        console.log(load); //判断按钮事件
        $('.reg_suc').css('display','none');
        if(load=='reload'){
            window.location.reload();
        }else if(load=='close'){
            return;
        }else if(load=='back'){
            window.location.href='index.html'
        }
    });
}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值