重写alert样式

<style type="text/css">
    #msg{
        height: 2rem;
        text-align: center;
        position: fixed;
        top: 30%;
        margin-top: -1rem;
        /*line-height: 24rem;*/
        width: 100%;
        z-index: 99;
    }
    #msg span{
        color: black;
        display: inline-block;
        padding: 0 0;
        border-radius: 10px;
        background: url("__TMPL__Public/assets/images/tishi.png") no-repeat center top white;
        padding-top: 11rem;
        box-shadow: 0 0 20px 2px rgba(0,0,0,.4);
        height: 260px;
        width: 420px;
    }
    #msg span a{
        /*font-size: 20px;*/
        /*line-height: 5rem;*/
        background: #F53E3E;
        padding: 5px 24px;
        border-radius: 3px;
        color: white;
        margin: 15px 145px;
    }
    #msg .sure-btn:hover{
        /*background: #589BF7;*/
        text-decoration: none;
    }
</style>

 

注释的是定时器   没有注释的是点击确定才会消失弹框

<script type="text/javascript">
    function alert(e){
        $("body").append("<div id='msg'><div id='zhezhaoceng'><span>"+e+"<br />"+"<a href='javascript:;' class='sure-btn'>确定</a></span></div></div>");
        // clearmsg();
    }
    function clearmsg(){
        var t = setTimeout(function(){
            $("#msg").remove();
        },3000)
    };
    $("body").on('click','.sure-btn',function(){
        $('#msg').remove();
    })
    // $('.sure-btn').click(function(){
    //     $('#msg').remove();
    // })
</script>

转载于:https://my.oschina.net/u/3853452/blog/1933649

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值