-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
70 lines (70 loc) · 2.43 KB
/
index.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
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>tinyscroll demo</title>
<link rel="stylesheet" href="./node_modules/animate.css/animate.css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="./src/tinyscroll.css" media="screen" title="no title" charset="utf-8">
<style media="screen">
.input-group {
padding: 10px;
overflow: hidden;
}
input[type="text"] {
float: left;
border: 1px solid #ddd;
width: 120px;
height: 30px;
text-align: center;
font-size: 14px;
font-weight: bold;
}
button {
margin-left: 10px;
border: none;
background-color: #05b47a;
color: #fff;
height: 30px;
width: 100px;
border-radius: 5px;
margin-top: 20px;
}
.date-tips {
display: block;
font-size: 14px;
line-height: 30px;
text-indent: 10px;
margin-top: 30px;
}
</style>
</head>
<body>
<div id="container"></div>
<p class="date-tips">日期:<span id="selectDate">yyyy-MM-DD hh:mm:ss</span></p>
<button type="button" id="button">选择出行日期</button>
<script src="./node_modules/jquery/dist/jquery.min.js" charset="utf-8"></script>
<script src="./src/tinyscroll.js" charset="utf-8"></script>
<script type="text/javascript">
var ts;
document.querySelector('#button').onclick = function() {
if (!ts) {
ts = new TinyScroll({
wrapper: '#container',
needLabel: true,
range: [new Date(), new Date(new Date().setFullYear(2017))],
time: true,
initDate: new Date(new Date().setFullYear(2016)),
cancelValue: '取消',
okValue: '确定',
okCallback: function(date) {
document.querySelector('#selectDate').innerHTML = date;
}
});
} else {
ts.showScroller();
}
}
</script>
</body>
</html>