自助移动端弹窗

  移动端能用alert弹窗么?嘿嘿,自己搞一个。

  function alertdiv(){       
     var alertdiv = $('<div class="overlay" style="z-index: 99999; left: 0px;"><div class="phone-alert"><div class="phone-alert-panel"><div class="phone-alert-content">请填写正确的手机</div><div class="phone-alert-line"></div><a href="javascript:void(0);" class="pbtn" id="confirmTag">确认</a></div></div></div>');
     $("body").append(alertdiv);
     tap($("#confirmTag")[0], function() {
	$(".overlay").remove();
     });
 }

  至于样式大家自己设计一个套一下就可以了。

  效果图如下:

      

  

.overlay {
    width: 100%;
    height: 100%;
    position: fixed;
    left: 0;
    top: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.phone-alert {
    width: 100%;
    position: absolute;
    z-index: 99999;
    top: 30%;
}

.phone-alert-panel {
    width: 80%;
    background-color: #FFF;
    border-radius: 0.6em;
    margin: 0 auto;
    text-align: center;
    padding-bottom: 1.5em;
    box-shadow: .1em .4em 0 0 #999;
    overflow: hidden;
}

.phone-alert-content {
    padding: 2em 2em;
    font-size: 1.3em;
}

.phone-alert-line {
    border-bottom: 1px #ccc dashed;
    height: 1px;
    margin-bottom: 1.5em;
}

.pbtn {
    display: inline-block;
    height: 3em;
    line-height: 3em;
    padding: 0 2em;
    background: #11C258;
    border-radius: 0.3em;
    box-shadow: .1em .3em 0 0 #CCC;
    color: #FFF;
    font-weight: 700;
    font-size: 120%;
}

  

  然后这也不算插件啦,写得有所欠缺,还望海涵。

转载于:https://www.cnblogs.com/jiangbanji/p/6025984.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值