forked from 121595113/mobiscroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
59 lines (54 loc) · 1.6 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>移动端时间选择插件用例</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" type="text/css" href="mobiscroll.css">
<script type="text/javascript" src="zepto.min.js"></script>
<script type="text/javascript" src="./mobiscroll.js"></script>
</head>
<body>
<input type="text" id="appDate" placeholder="" value="" readonly="readonly">
<script type="text/javascript">
$(function() {
var currYear = (new Date()).getFullYear();
var opt = {};
opt.date = {
preset: 'date'
};
opt.defaultVal = {
theme: 'android-ics light', //皮肤样式
display: 'modal', //显示方式
mode: 'scroller', //日期选择模式
dateFormat: 'yyyy-mm-dd',
lang: 'zh',
title: '选择日期',
showNow: true,
startYear: 2011, //开始年份
endYear: currYear, //结束年份
onSelect: function(val) {
// 选择日期的回调可以写在这里
console.log(val)
},
onShow: function(dw,v){
var $dw = $('.dw');
var height = $dw.height();
$dw.css({
'top': ($(window).height() - height) / 2
})
$('.dw-persp').height($(window).height());
$(dw).css({
'position': 'fixed',
'top': 0,
'left': 0,
'width': '100%',
'height': '100%'
})
}
};
$("#appDate").mobiscroll($.extend({}, opt['date'], opt['defaultVal']));
});
</script>
</body>
</html>