利用mobiscroll 插件弹出指定的内容提供给用户选择
<!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="sqh_dialog">
<select name="Cities" id="demo_select" class="sqh_color_99" data-role="none">
<option value="">一个月</option>
<option value="1">Atlanta</option>
<option value="2">Berlin</option>
<option value="3">Boston</option>
<option value="4">Chicago</option>
<option value="5">London</option>
<option value="6">Los Angeles</option>
<option value="7">New York</option>
<option value="555中文">Paris</option>
<option value="9">San Francisco</option>
</select>
</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>
// Select demo initialization
$('#demo_select').mobiscroll().select({
theme: 'ios',
mode: 'scroller',
display: 'bottom',
inputClass: 'clear_border text-right ',
btnClass : 'sqh_color_56 font_16 sqh_line_height_15 margin_10 sqh_font_type',
//设置为false,则点击空白地方不会关闭弹出层,默认为true
closeOnOverlay:false,
lang: 'zh'
});
$(function(){
//调换取消按钮 和 确定 按钮的位置
function showDialog(obj){
//dialog显示的内容
$("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(valueText,inst){
//显示的是select标签选中的值
console.log("valueText : " + valueText);
//显示select 的value的值
console.log("inst._tempValue : " + inst._tempValue);
console.dir("inst : " + inst);
//显示select 的value的值
alert($('#demo_select').mobiscroll('getValue'));
},
"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',
inputClass: 'clear_border text-right ',
btnClass : 'sqh_color_56 font_16 sqh_line_height_15 margin_10 sqh_font_type',
lang: 'zh'
}
var nowSettings = $.extend(defaultSetting,settings);
$('#demo_select').mobiscroll().select(nowSettings);
});
function test(){
$('#sqh_dialog').mobiscroll("show");
}
</script>