mobiscroll 自定义dialog

利用mobiscroll 的select 插件自定义 弹出的对话框,这个仅供自己学习

例子

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>mobiscroll_calendar</title>
</head>
<body class="sqh_bg_fafafa">
    <div id="huangbiao">
       <!--<button onclick="showDialog(this)">弹出对话框</button>-->
       <button onclick="test(this)">弹出对话框</button>
    </div>

    <!-- 用于设置对话框 -->
    <div id="sqh_dialog"></div>

</body>
</html>
<script src="../js/jquery.min.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.core.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.frame.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.scroller.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.util.datetime.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.datetimebase.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.datetime.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.select.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.listbase.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.image.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.treelist.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.frame.ios.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.frame.sense-ui.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.frame.wp.js"></script>
<script src="../package/mobiscroll/js/mobiscroll.mobiscroll-dark.js"></script>
<script src="../package/mobiscroll/js/i18n/mobiscroll.i18n.zh.js"></script>
<link rel="stylesheet" href="../package/mobiscroll/css/import.css">
<link rel="stylesheet" href="../css/sqh_style_v2.0.css">
<script>

$(function(){
    //调换取消按钮 和 确定 按钮的位置
    function showDialog(obj){
        //dialog显示的内容
        $("div.dwwc").css("height","190px").html('<div class="font_18 margin_top_15">您确定要取消订单</div>');
        $("div.dwbw").each(function(i,dom){
            var $currentObj = $(this);
            //将确定按钮与取消按钮交换位置
            if($currentObj.hasClass("dwb-s")){
                $currentObj.removeClass("dwb-s").addClass("dwb-c");
                //将确定按钮改为红色字体
                $currentObj.find("div").removeClass("sqh_color_56").addClass("sqh_font_color_red");
            }else{
                $currentObj.removeClass("dwb-c").addClass("dwb-s");
            }
        });
    }
    
    //自定义属性
    var settings = {
        "onSelect":function(){
            alert("button ok");
        },
        "btnClass" : 'sqh_color_56 font_16 sqh_line_height_15 margin_10 sqh_font_type',
        "onShow":showDialog
    }

    var defaultSetting = {
        theme: 'ios',
        mode: 'scroller',
        display: 'bottom',
        btnClass : 'sqh_color_56 font_16 sqh_line_height_15 margin_10 sqh_font_type',
        minDate: new Date(2015, 3, 27),
        lang: 'zh'
    }

    var nowSettings = $.extend(defaultSetting,settings);
    $('#sqh_dialog').mobiscroll().date(nowSettings);
});


function test(){
    $('#sqh_dialog').mobiscroll("show");
}

</script>

 

效果

mobiscroll 自定义dialog

 

附件中有相关的插件

 

 

 

 

你可能感兴趣的:(dialog)