-
Notifications
You must be signed in to change notification settings - Fork 169
/
Copy pathindex4.html
245 lines (236 loc) · 12.7 KB
/
index4.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flexible Calendar</title>
<meta name="description" content="Blueprint: Vertical Timeline" />
<meta name="keywords" content="timeline, vertical, layout, style, component, web development, template, responsive" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" type="text/css" href="css/timeline.css" />
<link rel="stylesheet" type="text/css" href="css/calendar.css" />
<link rel="stylesheet" type="text/css" href="css/custom_4.css" />
<script src="js/modernizr.custom.63321.js"></script>
</head>
<body>
<div class="container">
<!-- Codrops top bar -->
<div class="codrops-top clearfix" style="text-align: center;">
<a href="http://tympanus.net/Development/Stapel/" style="float: left"><strong>« Previous Demo: </strong>Adaptive Thumbnail Pile Effect</a>
<a id="view" href="#">View Calendar</a>
<span class="right">
<a href="http://tympanus.net/codrops/?p=12416"><strong>Back to the Codrops Article</strong></a>
</span>
</div><!--/ Codrops top bar -->
<div class="main">
<div class="custom-calendar-wrap">
<div id="custom-inner" class="custom-inner">
<div class="custom-header clearfix">
<nav>
<span id="custom-prev" class="custom-prev"></span>
<span id="custom-next" class="custom-next"></span>
</nav>
<h2 id="custom-month" class="custom-month"></h2>
<h3 id="custom-year" class="custom-year"></h3>
</div>
<div id="calendar" class="fc-calendar-container"></div>
</div>
</div>
<header class="clearfix">
<h1>Calendario <span>It just got more flexible</span></h1>
<nav class="codrops-demos">
<a href="index.html">Demo 1</a>
<a href="index2.html">Demo 2</a>
<a href="index3.html">Demo 3</a>
<a class="current-demo" href="index4.html">Demo 4</a>
</nav>
</header>
<ul class="cbp_tmtimeline">
<li class="all-day">
<time class="cbp_tmtime" datetime="all-day"><span>all-day</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="00:00"><span>00:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="01:00"><span>01:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="02:00"><span>02:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="03:00"><span>03:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="04:00"><span>04:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="05:00"><span>05:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="06:00"><span>06:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="07:00"><span>07:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="08:00"><span>08:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="09:00"><span>09:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="10:00"><span>10:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="11:00"><span>11:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="12:00"><span>12:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="13:00"><span>13:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="14:00"><span>14:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="15:00"><span>15:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="16:00"><span>16:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="17:00"><span>17:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="18:00"><span>18:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="19:00"><span>19:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="20:00"><span>20:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="21:00"><span>21:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="22:00"><span>22:00</span></time>
</li>
<li>
<time class="cbp_tmtime" datetime="23:00"><span>23:00</span></time>
</li>
</ul>
</div>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.calendario.js"></script>
<script type="text/javascript" src="js/dataTimeline.js"></script>
<script>
(function($){
$(window).load(function(){
var once = false,
today = new Date(Date.now()),
zoneH = parseInt(today.getTimezoneOffset() / 60),
zoneM = parseInt(today.getTimezoneOffset() % 60),
zoneS = (zoneH < 0 ? '+' : '-') + (Math.abs(zoneH) < 10 ? '0' + Math.abs(zoneH) : Math.abs(zoneH)) + ':' +
(Math.abs(zoneM) < 10 ? '0' + Math.abs(zoneM) : Math.abs(zoneM));
$(document).on('shown.calendar.calendario', function(e, instance){
if(!once) {
$('.custom-calendar-wrap').slideUp();
init();
instance.getCell(today.getDate()).trigger('custom.calendario');
once = true;
}
});
$('#view').on('click calClick', function(e){
e.preventDefault();
$('.custom-calendar-wrap').slideToggle();
});
var transEndEventNames = {
'WebkitTransition' : 'webkitTransitionEnd',
'MozTransition' : 'transitionend',
'OTransition' : 'oTransitionEnd',
'msTransition' : 'MSTransitionEnd',
'transition' : 'transitionend'
},
transEndEventName = transEndEventNames[Modernizr.prefixed('transition')],
$wrapper = $('#custom-inner'),
$calendar = $('#calendar'),
cal = $calendar.calendario({
onDayClick : function( $el, data, dateProperties ) {
if( data.content.length > 0 ) {
if(data.startTime.length > 0) {
$('#view').trigger('calClick');
reset();
for(var i = 0; i < data.startTime.length; i++) {
if(data.allDay[i]) allDay(data.content[i]);
else date(data.content[i], data.startTime[i], data.endTime[i]);
}
}
}
},
onDayCustom : function( $el, data, dateProperties ) {
if( data.content.length > 0 ) {
if(data.startTime.length > 0) {
reset();
for(var i = 0; i < data.startTime.length; i++) {
if(data.allDay[i]) allDay(data.content[i]);
else date(data.content[i], data.startTime[i], data.endTime[i]);
}
}
}
},
caldata : timelineEvents,
displayWeekAbbr : true,
events: 'click, custom',
zone: zoneS
}),
$month = $( '#custom-month' ).html( cal.getMonthName() ),
$year = $( '#custom-year' ).html( cal.getYear() );
$( '#custom-next' ).on( 'click', function() {
cal.gotoNextMonth( updateMonthYear );
});
$( '#custom-prev' ).on( 'click', function() {
cal.gotoPreviousMonth( updateMonthYear );
});
function init() {
var d = new Date(), time, hour;
$('ul > li:not(.all-day)').each(function(i, e){
time = $(e).find('time').attr('datetime');
hour = parseInt(time.split(':')[0]);
d.setHours(hour, 0, 0, 0);
$(e).find('time').attr('datetime', d.toISOString());
if(hour < 10) $(e).find('time > span').html('0' + hour + ':' + '00<h6>AM</h6>');
else if(hour < 12 && hour >= 10) $(e).find('time > span').html(hour + ':' + '00<h6>AM</h6>');
else if(hour == 12) $(e).find('time > span').html(hour + ':' + '00<h6>PM</h6>');
else if(hour < 22 && hour > 12) $(e).find('time > span').html('0' + (hour - 12) + ':' + '00<h6>PM</h6>');
else if(hour >= 22) $(e).find('time > span').html((hour - 12) + ':' + '00<h6>PM</h6>');
});
}
function updateMonthYear() {
$month.html( cal.getMonthName() );
$year.html( cal.getYear() );
}
function allDay(content) {
$('li.all-day').append('<div class="cbp_tmlabel">' + content + '</div>');
}
function date(content, start, end) {
var pos = start.getHours() + 2,
top = ((start.getMinutes() / 60) * 200) == 0 ? '-1px' : ((start.getMinutes() / 60) * 200) - 1 + 'px',
height = ((((end.getTime() - start.getTime()) / (60 * 1000 * 60)) * 200) - 1) + 'px',
append = '<div class="cbp_tmlabel" style="top:'+ top + ';height:' + height + '; max-height:' + height + '">' +
content + '</div>';
$('ul > li:nth-child(' + pos +')').append(append);
}
function reset() {
$('li').find('div.cbp_tmlabel').remove();
}
});
})(jQuery);
</script>
</body>
</html>