手机提示框

来源:互联网 发布:央视网软件下载 编辑:程序博客网 时间:2024/04/20 09:41

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

//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);    });}
0 0