index.html
11.5 KB
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
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>多功能jQuery日期控件asDatepicker - 素材家园(www.sucaijiayuan.com)</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/prism.css">
<link rel="stylesheet" href="../css/asDatepicker.css">
</head>
<body>
<div id="toc"></div>
<div class="container">
<h1>jQuery.asDatepicker</h1>
<section>
<h2>Examples</h2>
<p>You can pass these options as key/value object to $.asDatepicker() method. </p>
<section>
<h3>default single</h3>
<pre class="has-example"><code class="language-markup">
<input type="text" id="calendar">
<script>
$(document).ready(function(){
$("#calendar").asDatepicker();
});
<script></code></pre>
<div class="example">
<!-- <input type="text" id="calendar" data-range-mode="section" data-selectable-year="2001>2010,2013,2015>2018"> -->
<input type="text" id="calendar">
</div>
</section>
<section>
<h3>range</h3>
<pre class="has-example"><code class="language-markup">
<input type="text" id="calendar2">
<script>
$(document).ready(function(){
$("#calendar2").asDatepicker({mode: 'range'});
});
<script></code></pre>
<div class="example">
<input type="text" id="calendar2" style="width:170px;">
</div>
</section>
<section>
<h3>multiple</h3>
<pre class="has-example"><code class="language-markup">
<input type="text" id="calendar3">
<script>
$(document).ready(function(){
$("#calendar3").asDatepicker({mode: 'multiple', calendars: '4'});
});
<script></code></pre>
<div class="example">
<input type="text" id="calendar3">
</div>
</section>
<section>
<h3>Data attributes</h3>
<p>Any option of the asDatepicker can also be set via data-attributes.</p>
<p>Such as:</p>
<pre class="has-example"><code class="language-markup">
<input type="text" id="calendar4" data-mode="range" data-range-mode="section" data-selectable-year="2001>2010,2012,2014>2016">
<script>
$(document).ready(function(){
$("#calendar4").asDatepicker();
});
<script></code></pre>
<div class="example">
<input type="text" id="calendar4" data-mode="range" data-range-mode="section" data-selectable-year="2001>2010,2012,2014>2016">
</div>
</section>
<section>
<h3>Mobile Single</h3>
<pre class="has-example"><code class="language-markup">
<input type="text" id="calendar-mobile-single">
<script>
$(document).ready(function(){
$('#calendar-mobile-single').asDatepicker({
mobileMode: true
});
});
<script>
</code></pre>
<div class="example">
<input type="text" id="calendar-mobile-single">
</div>
</section>
<section>
<h3>Mobile Range</h3>
<pre class="has-example"><code class="language-markup">
<input type="text" id="calendar-mobile-range">
<script>
$(document).ready(function(){
$('#calendar-mobile-range').asDatepicker({
mode: 'range',
mobileMode: true
});
});
<script>
</code></pre>
<div class="example">
<input type="text" id="calendar-mobile-range">
</div>
</section>
<section>
<h3>Mobile Multiple</h3>
<pre class="has-example"><code class="language-markup">
<input type="text" id="calendar-mobile-multiple">
<script>
$(document).ready(function(){
$('#calendar-mobile-multiple').asDatepicker({
mode: 'multiple',
mobileMode: true
});
});
<script>
</code></pre>
<div class="example">
<input type="text" id="calendar-mobile-multiple">
</div>
</section>
</section>
<section>
<h2>Keyboard navigation</h2>
<p> <span>left arrow ----- </span> highlights previous day </p>
<p> <span>right arrow ----- </span> highlights next day </p>
<p> <span>up arrow ----- </span> highlights same day from the previous week </p>
<p> <span>down arrow ----- </span> highlights same day from the next week </p>
<p> <span>ctrl + left arrow ----- </span> navigates to previous month </p>
<p> <span>ctrl + right arrow ----- </span> navigates to next month </p>
<p> <span>ctrl + up arrow ----- </span> navigates to higher view </p>
<p> <span>ctrl + down arrow ----- </span> navigates to lower view </p>
<p> <span>alt + left arrow ----- </span> focus in previous calendar </p>
<p> <span>alt + right arrow ----- </span> focus in next calendar </p>
<p> <span>enter ----- </span> if in "days" view selects the highlighted day. In other views navigates to a lower view </p>
<p> <span>esc ----- </span> closes the popup </p>
</section>
<section>
<h2>Available options</h2>
<p>You can pass these options as key/value object to $.asDatepicker() method. </p>
</section>
<section>
<h2>API</h2>
<section>
<h3>DisplayMode</h3>
<p>With default dropdown and inline</p>
<pre class="has-example"><code class="language-markup">
$("#calendar-api-displayMode").asDatepicker({displayMode: 'inline'});</code></pre>
<div class="example">
<input type="text" id="calendar-api-displayMode">
</div>
</section>
<section>
<h3>show()</h3>
<pre class="has-example"><code class="language-markup">
$('#calendar-api-show').asDatepicker('show');</code></pre>
<div class="example">
<input type="text" class="asDatepicker" id="calendar-api-show">
<a href="#" id="calendar-api-show-click">Click to show calendar</a> </div>
</section>
<section>
<h3>hide()</h3>
<pre class="has-example"><code class="language-markup">
$('#calendar-api-show').asDatepicker('hide');</code></pre>
<div class="example">
<input type="text" class="asDatepicker" id="calendar-api-hide">
<a href="#" id="calendar-api-hide-click">Click to hide calendar</a> </div>
</section>
<section>
<h3>multipleClear()</h3>
<pre class="has-example"><code class="language-markup">
$('#calendar-api-multipleClear').asDatepicker('multipleClear');</code></pre>
<div class="example">
<input type="text" class="calendar-multiple" id="calendar-api-multipleClear">
<button id="api-multipleClear-click">Clear</button>
</div>
</section>
<section>
<h3>getWrap()</h3>
<pre class="has-example"><code class="language-markup">
$.asDatepicker('getWrap');</code></pre>
<div class="example">
<p>Returns the wrapper of the calendar.</p>
</div>
<section>
<h3>getInput()</h3>
<pre class="has-example"><code class="language-markup">
$.asDatepicker('getInput');</code></pre>
<div class="example"> Returns the input field. </div>
<section>
<h3>getDate()</h3>
<pre class="has-example"><code class="language-markup">
$('#calendar-api-getDate').asDatepicker('getDate');</code></pre>
<div class="example">
<p>Returns the currently selected date.</p>
<input type="text" class="asDatepicker" id="calendar-api-getDate">
<button id="api-getDate-click">getDate</button>
</div>
<div class="example info">
<div class="content" id="api-getDate-info"></div>
</div>
<section>
<h3>getDate(format)</h3>
<pre class="has-example"><code class="language-markup">
$('#calendar-api-getDate-format').asDatepicker('getDate', 'yyyy-mm-dd');</code></pre>
<div class="example">
<p>Returns the current date, formatted with the pattern given as the argument.</p>
<input type="text" class="asDatepicker" id="calendar-api-getDate-format">
<button id="api-getDate-format-click">getDate</button>
</div>
<div class="example info">
<div class="content" id="api-getDate-format-info"></div>
</div>
<section>
<h3>update()</h3>
<pre class="has-example"><code class="language-markup">
$('#calendar-api-update').asDatepicker();
$('#calendar-api-update').asDatepicker('update', {mode: 'range'});</code></pre>
<div class="example">
<p>Sets one or more options for the asDatepicker.</p>
<input type="text" class="asDatepicker" id="calendar-api-update">
<button id="api-update-click">update</button>
</div>
<section> </section>
<section>
<h2>Events</h2>
<section>
<h3>on_show</h3>
</section>
<section>
<h3>on_before_show</h3>
</section>
<section>
<h3>on_hide</h3>
</section>
<section>
<h3>on_change</h3>
</section>
<section>
<h3>on_render</h3>
</section>
</section>
<section>
<h2>Skin</h2>
</section>
<section>
<h2>Location</h2>
</section>
</div>
<script src="js/jquery.js"></script>
<script src="js/jquery.mobile.custom.js"></script>
<script src="js/jquery.toc.min.js"></script>
<script src="js/prism.js"></script>
<script src="../js/jquery-asDatepicker.js"></script>
<script>
$(document).ready(function(){
(function(){
$('#toc').toc();
})();
$("#calendar").asDatepicker({
namespace: 'calendar',
lang: 'zh',
position: 'bottom'
});
$("#calendar2").asDatepicker({
mode: 'range',
namespace: 'calendar',
lang: 'zh',
position: 'bottom'
});
$("#calendar3").asDatepicker({
mode: 'multiple',
calendars: 4,
});
$("#calendar4").asDatepicker();
$('#calendar-mobile-single').asDatepicker({
mobileMode: true
});
$('#calendar-mobile-range').asDatepicker({
mode: 'range',
mobileMode: true
});
$('#calendar-mobile-multiple').asDatepicker({
mode: 'multiple',
mobileMode: true
});
$('.asDatepicker').asDatepicker();
$('.calendar-multiple').asDatepicker({mode: 'multiple', calendars: 3});
$('#calendar-api-displayMode').asDatepicker({displayMode: 'inline'});
$('#calendar-api-show-click').click(function(){
$('#calendar-api-show').asDatepicker('show');
return false;
});
$('#calendar-api-hide-click').click(function(){
$('#calendar-api-hide').asDatepicker('hide');
return false;
});
$('#api-multipleClear-click').click(function() {
$("#calendar-api-multipleClear").asDatepicker('multipleClear');
return false;
});
$('#api-getDate-click').click(function() {
var html = '<div>' + $('#calendar-api-getDate').asDatepicker('getDate') + '</div>';
$(html).prependTo($('#api-getDate-info'));
return false;
});
$('#api-getDate-format-click').click(function() {
var html = '<div>' + $('#calendar-api-getDate-format').asDatepicker('getDate', 'yyyy-mm-dd') + '</div>';
$(html).prependTo($('#api-getDate-format-info'));
return false;
});
$('#api-update-click').click(function() {
$('#calendar-api-update').asDatepicker('update', {mode: 'range'});
return false;
});
});
</script>
</body>
</html>