forked from jdewit/bootstrap-timepicker
-
Notifications
You must be signed in to change notification settings - Fork 36
/
index.html
402 lines (392 loc) · 15.9 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
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
---
layout: default
title: Timepicker for Twitter Bootstrap
---
<!-- Timepicker
================================================== -->
<section id="timepicker">
<div class="center hero-unit" style="margin: 0; padding: 0;">
<br>
<br>
<br>
<h1>Bootstrap Timepicker</h1>
<p>This is the demo page for the original bootstrap 2 timepicker. Sorry but I haven't update to bootstrap 3 yet.</p>
<br>
<p class="lead">Easily select a time for a text input using your mouse or keyboards arrow keys.</p>
<p><a href="http://travis-ci.org/jdewit/bootstrap-timepicker"><img style="max-width:100%; height: 15px;" alt="Build Status" src="https://secure.travis-ci.org/jdewit/bootstrap-timepicker.png" target="_blank"></a></p>
<hr>
<div class="row">
<div class="span4 center">
<a href="https://github.com/jdewit/bootstrap-timepicker" target="_blank" class="btn btn-large btn-primary"><i class="icon-share-alt icon-white"></i> View Github Project</a>
</div>
<div class="span4 center">
<a href="http://www.pledgie.com/campaigns/19125"><img alt="Click here to support bootstrap-timepicker and make a donation with pledgie!" src="http://www.pledgie.com/campaigns/19125.png?skin_name=chrome" border="0" target="_blank"/></a>
</div>
<div class="span4 center">
<a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://jdewit.github.com/bootstrap-timepicker"></a>
<noscript><a href="http://flattr.com/thing/1116513/Bootstrap-Timepicker" target="_blank">
<img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a></noscript>
</div>
</div>
</div>
<br>
<br>
<h1>Installation</h1>
<hr>
<div>
<p>This project is registered as a <a href="http://twitter.github.com/bower/">Bower</a> package.</p>
<pre class="prettyprint linenums">
$ bower install bootstrap-timepicker
</pre>
</div>
<hr>
<h1>Demos</h1>
<hr>
<p>Default timepicker. Value = (<span id="timeDisplay"></span>)</p>
<div class="input-group bootstrap-timepicker">
<input id="timepicker1" class="input-small" type="text"/><span class="input-group-addon"><i class="icon-time"></i></span>
</div>
<a href="#timepicker1Source" data-toggle="collapse">+ View Source</a>
<div id="timepicker1Source" class="collapse">
<pre class="prettyprint linenums">
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="css/bootstrap.min.css" />
<link type="text/css" href="css/bootstrap-timepicker.min.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap-2.2.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap-timepicker.min.js"></script>
</head>
<body>
<div class="input-group bootstrap-timepicker">
<input id="timepicker1" type="text" class="input-small">
<span class="input-group-addon"><i class="icon-time"></i></span>
</div>
<script type="text/javascript">
$('#timepicker1').timepicker();
</script>
</body>
</html>
</pre>
</div>
<hr class="soften">
<p>Inside a modal with 24hr mode and seconds enabled.</p>
<div class="input-group bootstrap-timepicker">
<input id="timepicker2" class="input-small" type="text"/><span class="input-group-addon"><i class="icon-time"></i></span>
</div>
<a href="#timepicker2Source" data-toggle="collapse">+ View Source</a>
<div id="timepicker2Source" class="collapse">
<pre class="prettyprint linenums">
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="css/bootstrap.min.css" />
<link type="text/css" href="css/bootstrap-timepicker.min.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap-2.2.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap-timepicker.min.js"></script>
</head>
<body>
<div class="input-group bootstrap-timepicker">
<input id="timepicker2" type="text" class="input-small">
<span class="input-group-addon">
<i class="icon-time"></i>
</span>
</div>
<script type="text/javascript">
$('#timepicker2').timepicker({
minuteStep: 1,
template: 'modal',
appendWidgetTo: 'body',
showSeconds: true,
showMeridian: false,
defaultTime: false
});
</script>
</body>
</html>
</pre>
</div>
<hr class="soften">
<p>Without component markup, keyboard input disabled and floated right.</p>
<div class="bootstrap-timepicker pull-right" style="height: 2em;">
<a href="#timepicker3Source" data-toggle="collapse">+ View Source </a>
<input id="timepicker3" class="input-small" type="text" />
</div>
<br>
<br>
<div id="timepicker3Source" class="collapse">
<pre class="prettyprint linenums">
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="css/bootstrap.min.css" />
<link type="text/css" href="css/bootstrap-timepicker.min.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap-2.2.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap-timepicker.min.js"></script>
</head>
<body>
<div class="bootstrap-timepicker pull-right">
<input id="timepicker3" type="text" class="input-small">
</div>
<script type="text/javascript">
$('#timepicker3').timepicker({
minuteStep: 5,
showInputs: false,
disableFocus: true
});
</script>
</body>
</html>
</pre>
</div>
<hr class="soften">
<p>Inside a modal with backdrop enabled, inputs disabled and with a preset value.</p>
<div id="timepicker4Modal" class="modal hide fade">
<div class="modal-header">
<h1>A Timepicker Inside A Modal</h1>
</div>
<div class="modal-body" style="min-height: 150px;">
<span class="bootstrap-timepicker" style="vertical-align: middle;">
<input id="timepicker4" class="input-small" value="10:35 AM" type="text" />
<i class="icon-time" style="margin: -2px 0 0 -22.5px; pointer-events: none; position: relative;"></i>
</span>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-primary" data-dismiss="modal">OK</a>
</div>
</div>
<a class="btn btn-primary" href="#timepicker4Modal" data-toggle="modal">Open Modal</a>
<a href="#timepicker4Source" data-toggle="collapse"> + View Source</a>
<div id="timepicker4Source" class="collapse">
<pre class="prettyprint linenums">
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="css/bootstrap.min.css" />
<link type="text/css" href="css/bootstrap-timepicker.min.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap-2.2.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap-timepicker.min.js"></script>
</head>
<body>
<div> class="modal hide fade">
<div class="modal-header">
<h1>Timepicker inside a modal</h1>
</div>
<div class="modal-body">
<div class="bootstrap-timepicker">
<input id="timepicker4" type="text" value="10:35 AM" class="input-small">
<i class="icon-time"></i>
</div>
</div>
</div>
<script type="text/javascript">
$('#timepicker4').timepicker({
minuteStep: 1,
secondStep: 5,
showInputs: false,
template: 'modal',
modalBackdrop: true,
showSeconds: true,
showMeridian: false
});
</script>
</body>
</html>
</pre>
</div>
<hr class="soften">
<p>Without a template.</p>
<span class="bootstrap-timepicker">
<input id="timepicker5" class="input-small" type="text" />
<i class="icon-time" style="margin: -2px 0 0 -22.5px; pointer-events: none; position: relative;"></i>
</span>
<a href="#timepicker5Source" data-toggle="collapse"> + View Source</a>
<div id="timepicker5Source" class="collapse">
<pre class="prettyprint linenums">
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="css/bootstrap.min.css" />
<link type="text/css" href="css/bootstrap-timepicker.min.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap-2.2.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap-timepicker.min.js"></script>
</head>
<body>
<div class="bootstrap-timepicker">
<input id="timepicker5" type="text" class="input-small">
<i class="icon-time"></i>
</div>
<script type="text/javascript">
$('#timepicker5').timepicker({
template: false,
showInputs: false,
minuteStep: 5
});
</script>
</body>
</html>
</pre>
</div>
<hr>
<h1>Configuration</h1>
<hr>
<h3>template <small>The picker widget template</small></h3>
<div class="well">
<table class="options-table table table-bordered table-striped table-rounded">
<thead>
<tr>
<th style="width: 25%;">Name</th>
<th style="width: 25%;">Options / Defaults</th>
<th style="widget: 50%;">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>template</td>
<td>
'dropdown' (default)<hr />
'modal' <hr />
false
</td>
<td>
Show picker in a dropdown <hr />
Show picker in a modal <hr />
Don't show a widget
</td>
</tr>
<tr>
<td>minuteStep</td>
<td>15</td>
<td>Specify a step for the minute field.</td>
</tr>
<tr>
<td>showSeconds</td>
<td>false</td>
<td>Show the seconds field.</td>
</tr>
<tr>
<td>secondStep</td>
<td>15</td>
<td>Specify a step for the second field.</td>
</tr>
<tr>
<td>defaultTime</td>
<td>
'current' (default) <hr />
'11:45 AM' <hr />
false
</td>
<td>
Set to the current time. <hr />
Set to a specific time. <hr />
Do not set a default time
</td>
</tr>
<tr>
<td>showMeridian</td>
<td>
true (default) <hr />
false
</td>
<td>
12hr mode<hr />
24hr mode
</td>
</tr>
<tr>
<td>showInputs</td>
<td>
true (default) <hr />
false
</td>
<td>
Shows the text inputs in the widget. <hr />
Hide the text inputs in the widget
</td>
</tr>
<tr>
<td>disableFocus</td>
<td>false</td>
<td>Disables the input from focusing. This is useful for touch screen devices that display a keyboard on input focus.</td>
</tr>
<tr>
<td>disableMousewheel</td>
<td>false</td>
<td>Disables the input from changing on mousewheel events</td>
</tr>
<tr>
<td>modalBackdrop</td>
<td>false</td>
<td>Show modal backdrop.</td>
</tr>
</tbody>
</table>
</div>
<div>
<h3>Data Attributes</h3>
<p>Configuration options can also be set with the use of data attributes. </p>
<pre class="prettyprint linenums">
<div class="bootstrap-timepicker"/><input id="timepicker" data-template="modal" data-minute-step="1" data-modal-backdrop="true" type="text"/></div>
</pre>
</div>
<hr>
<h1>Methods</h1>
<hr>
<h3>showWidget <small>Show the picker widget</small></h3>
<pre class="prettyprint linenums">
var time = $('#timepicker').timepicker('showWidget');
</pre>
<h3>setTime <small>Set the time manually</small></h3>
<pre class="prettyprint linenums">
$('#timepicker').timepicker('setTime', '12:45 AM');
</pre>
<hr>
<h1>Events</h1>
<hr>
<div>
<h3> Show <small>Triggered when dropdown/modal widget is shown</small></h3>
<pre class="prettyprint linenums">
$('#timepicker').timepicker().on('show.timepicker', function(e) {
console.log('The time is ' + e.time.value);
console.log('The hour is ' + e.time.hour);
console.log('The minute is ' + e.time.minute);
console.log('The meridian is ' + e.time.meridian);
});
</pre>
<h3>Hide <small>Triggered when widget is hidden</small></h3>
<pre class="prettyprint linenums">
$('#timepicker').timepicker().on('hide.timepicker', function(e) {
console.log('The time is ' + e.time.value);
console.log('The hour is ' + e.time.hour);
console.log('The minute is ' + e.time.minute);
console.log('The meridian is ' + e.time.meridian);
});
</pre>
<h3>Update <small>Triggered when the date is updated</small></h3>
<pre class="prettyprint linenums">
$('#timepicker').timepicker().on('changeTime.timepicker', function(e) {
console.log('The time is ' + e.time.value);
console.log('The hour is ' + e.time.hour);
console.log('The minute is ' + e.time.minute);
console.log('The meridian is ' + e.time.meridian);
});
</pre>
<hr>
</div>
</section>