手机提示框

自己写的第一个小插件,虽然效果过怎么样,但还是很有成就感

//html部分
<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
    <title></title>
    <meta charset="utf-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" href="css/style.css"/>
</head>
<body>
    <div class="container">
        <a href="javascript:;" class="delorder">删除订单</a>
    </div>
    <script src="js/jquery-1.8.3.js"></script>
    <script src="js/js.js"></script>
</body>
</html>

//css部分
body{font-size:62.5%;}
p{margin: 0;padding: 0}
.mask{width: 100%;height:100%;background:#000;position: absolute;top: 0;left: 0;opacity: .2;z-index: 10;display: none}
.pop-up{width:25em;height: 13em;background:#fff;position: absolute;top:50%;left: 50%;margin-top:-7.5em;margin-left:-12.5em;z-index: 100;display: none;border: 1px solid #348df3;box-shadow: 0 0 10px 1px #333}
.pop-up-text{height:3em;padding-top:3em;text-align: center;font-size: 1.3em;color: #808080;}
.btn-groups{height:5em;padding-top: 2em}
.btn-groups div{font-size: 1.3em;float: left;margin-left:1em;line-height: 3em;text-align: center;cursor: pointer}
.btn-groups div:nth-of-type(1){border: 1px solid #9a9a9a;width:9.9em;height: 2.9em;color:#808080}
.btn-groups div:nth-of-type(2){background:#348df3;color: #fff;width: 10em;height: 3em}

//js部分

var msg='你是否已确认删除当前订单!';
var className=$('.delorder');
fn1(className,msg,function(type) {
    alert(type);
});
function fn1(className,msg,callback){
    function func(){
        $('body').append('<div class="mask"></div>' +
            '<div class="pop-up">' +
            '<p class="pop-up-text"></p>' +
            '<div class="btn-groups">' +
            '<div class="btn-cancel">取消</div>' +
            '<div class="btn-ensure">确定</div>' +
            '</div>' +
            '</div>')
    };
    func();
    className.click(function(){
        $('.pop-up-text').html(msg) ;
        $('.pop-up').show();
        $('.mask').show();
    });
    $('.btn-cancel').click(function fn2(){
        $('.pop-up').hide();
        $('.mask').hide();
        callback(false);

    });
    $('.btn-ensure').click(function fn3(){
        $('.pop-up').hide();
        $('.mask').hide();
        callback(true);
    });

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值