forked from component/calendar
-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.html
76 lines (66 loc) · 1.77 KB
/
example.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
71
72
73
74
75
76
<html>
<head>
<title>Calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="build/build.css" type="text/css">
<style>
body {
font: 14px "Helvetica Neue", Helvetica, Arial;
padding: 80px;
color: #333;
}
.calendar.large {
float: left;
clear: both;
}
.calendar.large tbody td {
padding: 50px;
border: 1px solid #eee;
position: relative;
}
.calendar.large tbody a {
position: absolute;
top: 5px;
right: 5px;
}
.calendar.small th {
font-size: 10px;
}
.calendar.small td a {
font-size: 10px;
padding: 3px;
}
</style>
</head>
<body>
<h1>Calendar</h1>
<script src="build/build.js"></script>
<script>
var Calendar = require('calendar');
var one = new Calendar().showMonthSelect().showYearSelect();
one.on('view change', function(date, action){
console.log('change %s', action);
var twoDate = new Date(date);
twoDate.setMonth(date.getMonth() + 1)
two.show(twoDate);
});
one.on('change', function(date){
console.log('selected: %s of %s %s',
date.getDate(),
date.getMonth(),
date.getFullYear());
var newDate = new Date(date);
newDate.setMonth(date.getMonth() + 1);
two.select(newDate);
});
one.el.appendTo('body');
var small = new Calendar;
small.addClass('small');
small.el.appendTo('body');
small.next();
var large = new Calendar;
large.addClass('large');
large.el.appendTo('body');
</script>
</body>
</html>