-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalendar.html
70 lines (61 loc) · 1.66 KB
/
calendar.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 content="width=device-width,height=device-height,maximum-scale=1.0, initial-scale=1.0, user-scalable=no" name="viewport">
<title>日历控件</title>
<link href="css/calendar.css" type="text/css" rel="stylesheet" />
<script src='js/Zepto.js'></script>
<!--<script src='js/jquery-3.2.1.min.js'></script>
<script src='js/jquery.mobile-events.min.js'></script>-->
</head>
<body>
<div id="calendarBox" class='calendar-container'>
</div>
</body>
<script src='js/calendar.js'></script>
<script>
var data = [{
'date': '2017-09-03',
'data': 10
}, {
'date': '2017-09-05',
'data': 5
}, {
'date': '2017-09-08',
'data': 5
}]
var minD = new Date();
var maxD = new Date();
maxD.setFullYear(minD.getFullYear()+1)
calendar.renderCalendar({
calendarContainer: '#calendarBox',
//月份从0-11,参数7实际为8月
minDate:minD,
maxDate:maxD,
//给日期区间绑定数据
// dateData: [1, 2, 3, 4, 5, 6, 7, 8]
dateData: [{
'date': '2017-08-03',
'data': 10
}, {
'date': '2017-08-10',
'data': 11
}],
});
calendar.eventHandle(
function(date) {
//date为点击日期返回的当前日期
console.log('回调=' + date + '被你点击了');
},
//月份改变执行事件
function(currYear,currMonth){
console.log('月份改变')
//data为日期数据
calendar.monthData(data);
console.log(currYear)
console.log(currMonth)
}
);
</script>
</html>