-
Notifications
You must be signed in to change notification settings - Fork 42
/
index.html
1174 lines (1122 loc) · 37.4 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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Datepickk - Documentation</title>
<link rel="stylesheet" href="dist/doc.css">
<link rel="stylesheet" href="dist/datepickk.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/styles/zenburn.min.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:400,600" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/highlight.min.js"></script>
</head>
<body>
<script src="dist/datepickk.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<div class="nav">
<h1>Datepickk<span> . js</span></h1>
<p>Made with <i class="fa fa-heart" style="color:#AA3F3F;"></i> by <a href="http://codepen.io/crsten">Carsten J</a>.</p>
<a class="github-button" href="https://github.com/crsten/datepickk" data-icon="octicon-star" data-style="mega" data-count-href="/crsten/datepickk/stargazers" data-count-api="/repos/crsten/datepickk#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star crsten/datepickk on GitHub">Star</a>
</div>
<div class="container">
<div class="row align-center equal-height" style="margin-bottom:50px;">
<h1 class="center" style="margin-bottom:50px;"><span class="line"></span>Get started<span class="line"></span></h1>
<div class="col-xs-12 col-md-4">
<pre style="max-width: 800px;margin: 0 auto;">
<code>
npm install datepickk<br>
</code>
</pre>
</div>
<div class="col-md-1 align-center align-middle">
or
</div>
<div class="col-xs-12 col-md-4">
<pre style="max-width: 800px;margin: 0 auto;">
<code>
bower install datepickk<br>
</code>
</pre>
</div>
<div class="col-xs-12" style="margin:50px 0;">
<pre style="max-width: 800px; margin: 0 auto;">
<code>
//Initialize<br>
var datepicker = new Datepickk();<br>
/*And some more stuff down there...*/
</code>
</pre>
<script>
var datepicker = new Datepickk();
</script>
</div>
<div class="col-xs-12 col-md-5 align-middle">
<button class="orange" style="margin:0 auto;" onclick="datepicker.show();">Modal<span>onclick="datepicker.show();"</span></button>
</div>
<div class="col-xs-12 col-md-1 align-middle align-center">
<p style="width:100%;text-align:center;">or</p>
</div>
<div class="col-xs-12 col-md-6 align-center" >
<div id="demoPicker" style="height:600px;width:100%;max-width: 600px;"></div>
<script>
var now = new Date();
var demoPicker = new Datepickk({
container: document.querySelector('#demoPicker'),
inline:true,
range: true,
tooltips: {
date: new Date(),
text: 'Tooltip'
},
highlight:{
start: new Date(now.getFullYear(),now.getMonth(),3),
end: new Date(now.getFullYear(),now.getMonth(),6),
backgroundColor:'#05676E',
color:'#fff',
legend: 'Highlight'
}
});
</script>
</div>
</div>
<div class="row align-center" id="browsers">
<div class="col-xs-3 align-center">
<i class="fa fa-chrome"></i>
<p>31 +</p>
</div>
<div class="col-xs-3 align-center">
<i class="fa fa-firefox"></i>
<p>31 +</p>
</div>
<div class="col-xs-3 align-center">
<i class="fa fa-internet-explorer"></i>
<p>10 +</p>
</div>
<div class="col-xs-3 align-center">
<i class="fa fa-safari"></i>
<p>Not tested yet</p>
</div>
</div>
<div class="row align-center equal-height" id="index">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 block">
<h2>Settings</h2>
<ul>
<li><a href="#startDate">startDate</a></li>
<li><a href="#minDate">minDate</a></li>
<li><a href="#maxDate">maxDate</a></li>
<li><a href="#currentDate">currentDate</a></li>
<li><a href="#currentDate">setDate (alias)</a></li>
<li><a href="#maxSelections">maxSelections</a></li>
<li><a href="#months">months</a></li>
<li><a href="#title">title</a></li>
<li><a href="#button">button</a></li>
<li><a href="#lang">lang</a></li>
<li><a href="#weekStart">weekStart</a></li>
<li><a href="#range">range</a></li>
<li><a href="#container">container</a></li>
<li><a href="#inline">inline</a></li>
<li><a href="#closeOnSelect">closeOnSelect</a></li>
<li><a href="#closeOnClick">closeOnClick</a></li>
<li><a href="#tooltips">tooltips</a></li>
<li><a href="#highlight">highlight</a></li>
<li><a href="#disabledDays">disabledDays</a></li>
<li><a href="#disabledDates">disabledDates</a></li>
<li><a href="#today">today</a></li>
<li><a href="#daynames">daynames</a></li>
<li><a href="#fullscreen">fullscreen</a></li>
<li><a href="#locked">locked</a></li>
</ul>
</div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 block">
<h2>Status</h2>
<ul>
<li><a href="#selectedDates">selectedDates</a></li>
<li><a href="#isOpen">isOpen</a></li>
</ul>
</div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 block">
<h2>Functions</h2>
<ul>
<li><a href="#show">show(props)</a></li>
<li><a href="#hide">hide()</a></li>
<li><a href="#selectDate">selectDate(Date,ignoreOnSelect)</a></li>
<li><a href="#unselectDate">unselectDate(Date,ignoreOnSelect)</a></li>
<li><a href="#unselectAll">unselectAll(ignoreOnSelect)</a></li>
</ul>
</div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 block">
<h2>Callbacks</h2>
<ul>
<li><a href="#onConfirm">onConfirm</a></li>
<li><a href="#onClose">onClose</a></li>
<li><a href="#onSelect">onSelect</a></li>
<li><a href="#onNavigation">onNavigation</a></li>
</ul>
</div>
</div>
<h1 class="center"><span class="line"></span>Take a tour<span class="line"></span></h1>
<div class="row equal-height">
<div class="col-xs-12 col-md-6 block" id="startDate">
<h2>startDate <span>Setting</span> <a href="#index">Go up</a></h2>
<pre>
<code>
//Type: Date<br>
//Default: null -> takes current date<br>
//Reset: assign non date object to reset default<br><br>
/*Set startDate*/<br>
datepicker.startDate = new Date(2000,0,1);<br><br>
/*Get startDate*/<br>
console.log(datepicker.startDate);
</code>
</pre>
<button class="grey full" onclick="startDateDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>Each time you show the calendar this date will show up!</p>
<script>
function startDateDemo(){
datepicker.unselectAll();
datepicker.startDate = new Date(2000,0,1);
console.log(datepicker.startDate);
datepicker.onClose = function(){
datepicker.startDate = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="minDate">
<h2>minDate <span>Setting</span> <a href="#index">Go up</a></h2>
<pre>
<code>
//Type: Date<br>
//Default: null -> no limit<br>
//Reset: assign non date object to reset default<br><br>
/*Set minDate*/<br>
datepicker.minDate = new Date(2015,0,1);<br><br>
/*Get minDate*/<br>
console.log(datepicker.minDate);
</code>
</pre>
<button class="grey full" onclick="minDateDemo()">Let's try that</button>
<script>
function minDateDemo(){
datepicker.unselectAll();
datepicker.minDate = new Date(2015,0,1);
datepicker.startDate = new Date(2015,0,1);
console.log(datepicker.minDate);
datepicker.onClose = function(){
datepicker.minDate = null;
datepicker.startDate = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="maxDate">
<h2>maxDate <span>Setting</span> <a href="#index">Go up</a></h2>
<pre>
<code>
//Type: Date<br>
//Default: null -> no limit<br>
//Reset: assign non date object to reset default<br><br>
/*Set maxDate*/<br>
datepicker.maxDate = new Date(2015,11,31);<br><br>
/*Get maxDate*/<br>
console.log(datepicker.maxDate);
</code>
</pre>
<button class="grey full" onclick="maxDateDemo()">Let's try that</button>
<script>
function maxDateDemo(){
datepicker.unselectAll();
datepicker.maxDate = new Date(2015,11,31);
datepicker.startDate = new Date(2015,11,1);
console.log(datepicker.maxDate);
datepicker.onClose = function(){
datepicker.maxDate = null;
datepicker.startDate = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="currentDate">
<h2>currentDate | setDate (alias) <span>Setting</span> <a href="#index">Go up</a></h2>
<pre>
<code>
//Type: Date<br>
//Default: current date<br><br>
/*Set currentDate*/<br>
datepicker.currentDate = new Date(2015,3,1);<br>
//OR<br>
datepicker.setDate = new Date(2015,3,1)<br><br>
/*Get currentDate*/<br>
console.log(datepicker.currentDate);
</code>
</pre>
<button class="grey full" onclick="currentDateDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>Use me to jump to spesific dates</p>
<script>
function currentDateDemo(){
datepicker.unselectAll();
datepicker.setDate = new Date(2015,3,1);
console.log(datepicker.currentDate);
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="maxSelections">
<h2>maxSelections <span>Setting</span> <a href="#index">Go up</a></h2>
<pre>
<code>
//Type: Number<br>
//Default: null -> infinite<br>
//Reset: assign non number object to reset default<br><br>
/*Set maxSelections*/<br>
datepicker.maxSelections = 3;<br><br>
/*Get maxSelections*/<br>
console.log(datepicker.maxSelections);
</code>
</pre>
<button class="grey full" onclick="maxSelectionsDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>If you don't want to let the user select anyting you should use <a href="#locked">locked</a> instead. Check it out</p>
<script>
function maxSelectionsDemo(){
datepicker.unselectAll();
datepicker.maxSelections = 3;
console.log(datepicker.maxSelections);
datepicker.onClose = function(){
datepicker.maxSelections = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="months">
<h2>months <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">
If you need to show multiple months at once this feature is perfect for you!
</p>
<pre>
<code>
//Type: Number (must be > 0)<br>
//Default: 1<br><br>
/*Set maxSelections*/<br>
datepicker.months = 2;<br><br>
/*Get months*/<br>
console.log(datepicker.months);
</code>
</pre>
<button class="grey full" onclick="monthsDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>Showing multiple months at once needs much space! Be careful, the pretty looking datepicker might get ulgy <i class="fa fa-thumbs-o-down"></i></p>
<script>
function monthsDemo(){
datepicker.unselectAll();
datepicker.months = 2;
console.log(datepicker.months);
datepicker.onClose = function(){
datepicker.months = 1;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="title">
<h2>title <span>Setting</span> <a href="#index">Go up</a></h2>
<pre>
<code>
//Type: String<br>
//Default: null<br>
//Reset: assign non string object to reset default<br><br>
/*Set title*/<br>
datepicker.title = 'Choose date:';<br><br>
/*Get title*/<br>
console.log(datepicker.title);
</code>
</pre>
<button class="grey full" onclick="titleDemo()">Let's try that</button>
<script>
function titleDemo(){
datepicker.unselectAll();
datepicker.title = 'Choose date:';
console.log(datepicker.title);
datepicker.onClose = function(){
datepicker.title = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="button">
<h2>button <span>Setting</span> <a href="#index">Go up</a></h2>
<pre>
<code>
//Type: String<br>
//Default: null<br>
//Reset: assign non string object to reset default<br><br>
/*Set button*/<br>
datepicker.button = 'OK';<br><br>
/*Get button*/<br>
console.log(datepicker.button);
</code>
</pre>
<button class="grey full" onclick="buttonDemo()">Let's try that</button>
<script>
function buttonDemo(){
datepicker.unselectAll();
datepicker.button = 'OK';
console.log(datepicker.button);
datepicker.onClose = function(){
datepicker.button = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="lang">
<h2>lang <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">
You can change the language and the day the week starts by changing the lang property.<br>
By default there are 5 languages: English (en), Norwegian (no), German (de), Swedish (se), Russian (ru). <br>
Add your own languages to the 'languages' property in the source code.
</p>
<pre>
<code>
//Type: String<br>
//Default: 'en'<br><br>
/*Set lang*/<br>
datepicker.lang = 'no';<br><br>
/*Get lang*/<br>
console.log(datepicker.lang);
</code>
</pre>
<button class="grey full" onclick="langDemo()">Let's try that</button>
<script>
function langDemo(){
datepicker.unselectAll();
datepicker.lang = 'no';
console.log(datepicker.lang);
datepicker.onClose = function(){
datepicker.lang = 'en';
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="weekStart">
<h2>weekStart <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">
You can change when the week should start by setting the weekStart property to a number between 0 - 6 where 0 is sunday and 6 is saturday.
The languages have the weekStart predefined. So if you choose norwegian it will automatically start the week on monday if no weekStart has been set.
</p>
<pre>
<code>
//Type: Number<br>
//Default: from language<br><br>
/*Set weekStart*/<br>
datepicker.weekStart = 1; //week starts at monday<br><br>
/*Get weekStart*/<br>
console.log(datepicker.weekStart);
</code>
</pre>
<button class="grey full" onclick="weekStartDemo()">Let's try that</button>
<script>
function weekStartDemo(){
datepicker.weekStart = 1;
console.log(datepicker.weekStart);
datepicker.onClose = function(){
datepicker.weekStart = 0;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="range">
<h2>range <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">Do you need to select a range of two dates? Use this</p>
<pre>
<code>
//Type: Boolean<br>
//Default: false<br><br>
/*Set range*/<br>
datepicker.range = true;<br><br>
/*Get range*/<br>
console.log(datepicker.range);
</code>
</pre>
<button class="grey full" onclick="rangeDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>This one overwrites the <a href="#maxSelections">maxSelections</a> property with 2.</p>
<script>
function rangeDemo(){
datepicker.unselectAll();
datepicker.range = true;
console.log(datepicker.range);
datepicker.onClose = function(){
datepicker.range = false;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-8 block" id="container">
<h2>container <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">Do you not like modals? Don't worry you can place the datepicker in a container you want.</p>
<pre>
<code>
//Type: String(selector) or HTMLElement(no jQuery bro! You can do better;)<br>
//Default: document.body<br><br>
/*Set container*/<br>
datepicker.container = document.querySelector('#sampleContainer');<br><br>
/*Get container*/<br>
console.log(datepicker.range);
</code>
</pre>
<button class="grey full" onclick="containerDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>I'm pretty sure you will like <a href="#inline">inline</a> aswell</p>
<script>
function containerDemo(){
var container = document.querySelector('#sampleContainer');
container.innerHTML = '';
var cdatepicker = new Datepickk();
cdatepicker.button = 'Close me';
cdatepicker.unselectAll();
cdatepicker.container = container;
console.log(cdatepicker.container);
cdatepicker.onClose = function(){
cdatepicker = null;
container.innerHTML = '<p>Hi! My name is #sampleContainer</p>'
}
cdatepicker.show();
}
</script>
</div>
<div class="col-xs-4 block align-center align-middle" id="sampleContainer">
<p>Hi! My name is #sampleContainer</p>
</div>
<div class="col-xs-8 block" id="inline">
<h2>inline <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">If you set a container and set inline true it will always be visible and you don't need to show it first</p>
<pre>
<code>
//Type: Boolean<br>
//Default: false<br><br>
/*Set inline*/<br>
datepicker.inline = true;<br><br>
/*Get inline*/<br>
console.log(datepicker.inline);
</code>
</pre>
<button class="grey full" onclick="inlineDemo()">Initialize me</button>
<p><i class="fa fa-lightbulb-o hint"></i>You should set <a href="#container">container</a> first</p>
<script>
function inlineDemo(){
var container = document.querySelector('#inlineContainer');
var height = document.querySelector('#inline').getBoundingClientRect().height;//Hey don't judge me! everything is built with flexbox :) that's why i need to do this
container.setAttribute('style','height:' + height + 'px;');
container.innerHTML = '';
var idatepicker = new Datepickk({
container: container,
inline: true
});
console.log(idatepicker.inline);
}
</script>
</div>
<div class="col-xs-4 block align-center align-middle" id="inlineContainer">
<p>Hi! My name is #inlineContainer</p>
</div>
<div class="col-xs-12 col-md-6 block" id="closeOnSelect">
<h2>closeOnSelect <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">If a date gets selected the datepicker will close</p>
<pre>
<code>
//Type: Boolean<br>
//Default: false<br><br>
/*Set closeOnSelect*/<br>
datepicker.closeOnSelect = true;<br><br>
/*Get closeOnSelect*/<br>
console.log(datepicker.closeOnSelect);
</code>
</pre>
<button class="grey full" onclick="closeOnSelectDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>This is not the same as <a href="#closeOnClick">closeOnClick</a></p>
<script>
function closeOnSelectDemo(){
datepicker.unselectAll();
datepicker.closeOnSelect = true;
console.log(datepicker.closeOnSelect);
datepicker.onClose = function(){
datepicker.closeOnSelect = false;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="closeOnClick">
<h2>closeOnClick <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">If someone clicks outside the datepicker it closes</p>
<pre>
<code>
//Type: Boolean<br>
//Default: true<br><br>
/*Set closeOnClick*/<br>
datepicker.closeOnClick = false;<br><br>
/*Get closeOnClick*/<br>
console.log(datepicker.closeOnClick);
</code>
</pre>
<button class="grey full" onclick="closeOnClickDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>This is not the same as <a href="#closeOnSelect">closeOnSelect</a></p>
<script>
function closeOnClickDemo(){
datepicker.unselectAll();
datepicker.closeOnClick = false;
datepicker.button = 'Close me';
console.log(datepicker.closeOnClick);
datepicker.onClose = function(){
datepicker.closeOnClick = true;
datepicker.button = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="tooltips">
<h2>tooltips <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">Put some notes on it</p>
<pre>
<code>
//Type: Object or Array of Objects (look how the object is built in the other code block)<br>
//Default: null<br><br>
/*Set tooltips*/<br>
datepicker.tooltips = [tooltip,tooltip2];<br><br>
/*Get tooltips*/<br>
console.log(datepicker.tooltips);
</code>
</pre>
<pre>
<code>
/*tooltip object*/<br><br>
var tooltip = {<br>
date: new Date(2015,6,1),<br>
text: 'Tooltip'<br>
};<br><br>
var tooltip2 = {<br>
date: new Date(2015,6,4),<br>
text: 'Tooltip 2'<br>
};<br><br>
</code>
</pre>
<button class="grey full" onclick="tooltipsDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>Just put multiple tooltip objects in an array if you have more than 1 tooltip object</p>
<script>
function tooltipsDemo(){
var tooltip = {
date: new Date(2015,6,1),
text: 'Tooltip'
};
var tooltip2 = {
date: new Date(2015,6,4),
text: 'Tooltip 2'
};
datepicker.unselectAll();
datepicker.tooltips = [tooltip,tooltip2];
datepicker.setDate = new Date(2015,6,1);
console.log(datepicker.tooltips);
datepicker.onClose = function(){
datepicker.tooltips = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="highlight">
<h2>highlight <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">This is a nice way to mark stuff in the datepicker</p>
<pre>
<code>
//Type: Object or Array of Objects (look how the object is built in the other code block)<br>
//Default: null<br><br>
/*Set highlight*/<br>
datepicker.highlight = [highlight,highlight2];<br><br>
/*Get highlight*/<br>
console.log(datepicker.highlight);
</code>
</pre>
<pre>
<code>
/*highlight object*/<br><br>
/*Single daterange*/<br>
var highlight = {<br>
start: new Date(2015,6,13),<br>
end: new Date(2015,6,19),<br>
backgroundColor: '#3faa56',<br>
color: '#ffffff',<br>
legend: 'CSS Conf.'//this is optional<br>
};<br><br>
/*highlight with multiple dateranges*/<br>
var highlight2 = {<br>
dates: [<br>
{<br>
start: new Date(2015,6,6),<br>
end: new Date(2015,6,7)<br>
},<br>
{<br>
start: new Date(2015,6,22),<br>
end: new Date(2015,6,23)<br>
}<br>
],<br>
backgroundColor: '#E99C00',<br>
color: '#ffffff',<br>
legend: 'Holidays'//this is optional<br>
};
</code>
</pre>
<button class="grey full" onclick="highlightDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>Just put multiple highlight objects in an array if you have more than 1 highlight object</p>
<script>
function highlightDemo(){
var highlight = {
start: new Date(2015,6,13),
end: new Date(2015,6,19),
backgroundColor: '#3faa56',
color: '#ffffff',
legend: 'CSS Conf.'
};
var highlight2 = {
dates: [
{
start: new Date(2015,6,6),
end: new Date(2015,6,7)
},
{
start: new Date(2015,6,22),
end: new Date(2015,6,23)
}
],
backgroundColor: '#E99C00',
color: '#ffffff',
legend: 'Holidays'
};
datepicker.unselectAll();
datepicker.highlight = [highlight,highlight2];
datepicker.setDate = new Date(2015,6,1);
console.log(datepicker.highlight);
datepicker.onClose = function(){
datepicker.highlight = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="disabledDays">
<h2>disabledDays <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">You can disable spesific days</p>
<pre>
<code>
//Type: Number(0-6) or Array of Numbers(0-6)<br>
//Default: null<br><br>
/*Set disabledDays*/<br>
datepicker.disabledDays = 0;<br><br>
/*Get disabledDays*/<br>
console.log(datepicker.disabledDays);
</code>
</pre>
<button class="grey full" onclick="disabledDaysDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>This is not the same as <a href="#disabledDates">disabledDates</a></p>
<script>
function disabledDaysDemo(){
datepicker.unselectAll();
datepicker.disabledDays = 0;
console.log(datepicker.disabledDays);
datepicker.onClose = function(){
datepicker.disabledDays = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="disabledDates">
<h2>disabledDates <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">You can disable spesific days</p>
<pre>
<code>
//Type: Date or Array of Dates<br>
//Default: null<br><br>
/*Set disabledDates*/<br>
datepicker.disabledDates = [new Date(),new Date(2015,6,20)];<br><br>
/*Get disabledDates*/<br>
console.log(datepicker.disabledDates);
</code>
</pre>
<button class="grey full" onclick="disabledDatesDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>This is not the same as <a href="#disabledDays">disabledDays</a></p>
<script>
function disabledDatesDemo(){
datepicker.unselectAll();
datepicker.disabledDates = [new Date(),new Date(2015,6,20)];
datepicker.setDate = new Date(2015,6,1);
console.log(datepicker.disabledDates);
datepicker.onClose = function(){
datepicker.disabledDates = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="today">
<h2>today <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">Show little line on todays date</p>
<pre>
<code>
//Type: Boolean<br>
//Default: true<br><br>
/*Set today*/<br>
datepicker.today = true;<br><br>
/*Get today*/<br>
console.log(datepicker.today);
</code>
</pre>
<button class="grey full" onclick="todayDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>This is not the same as <a href="#currentDate">currentDate</a></p>
<script>
function todayDemo(){
datepicker.unselectAll();
console.log(datepicker.today);
datepicker.onClose = function(){
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="daynames">
<h2>daynames <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">Show/hide daynames line</p>
<pre>
<code>
//Type: Boolean<br>
//Default: true<br><br>
/*Set daynames*/<br>
datepicker.daynames = false;<br><br>
/*Get daynames*/<br>
console.log(datepicker.daynames);
</code>
</pre>
<button class="grey full" onclick="daynamesDemo()">Let's try that</button>
<script>
function daynamesDemo(){
datepicker.unselectAll();
datepicker.daynames = false;
console.log(datepicker.daynames);
datepicker.onClose = function(){
datepicker.daynames = true;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="fullscreen">
<h2>fullscreen <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">Shows the datepicker fullscreen</p>
<pre>
<code>
//Type: Boolean<br>
//Default: false<br><br>
/*Set fullscreen*/<br>
datepicker.fullscreen = true;<br><br>
/*Get fullscreen*/<br>
console.log(datepicker.fullscreen);
</code>
</pre>
<button class="grey full" onclick="fullscreenDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>This feature is not made for inline or container</p>
<script>
function fullscreenDemo(){
datepicker.unselectAll();
datepicker.fullscreen = true;
datepicker.button = 'Close me';
console.log(datepicker.fullscreen);
datepicker.onClose = function(){
datepicker.fullscreen = false;
datepicker.button = null;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="locked">
<h2>locked <span>Setting</span> <a href="#index">Go up</a></h2>
<p class="description">Locks the datepicker (viewonlymode)</p>
<pre>
<code>
//Type: Boolean<br>
//Default: false<br><br>
/*Set locked*/<br>
datepicker.locked = true;<br><br>
/*Get locked*/<br>
console.log(datepicker.locked);
</code>
</pre>
<button class="grey full" onclick="lockedDemo()">Let's try that</button>
<script>
function lockedDemo(){
datepicker.unselectAll();
datepicker.locked = true;
console.log(datepicker.fullscreen);
datepicker.onClose = function(){
datepicker.locked = false;
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="selectedDates">
<h2>selectedDates <span>Status</span> <a href="#index">Go up</a></h2>
<p class="description">Returns all selected dates</p>
<pre>
<code>
/*Get selectedDates*/<br>
console.log(datepicker.selectedDates);
</code>
</pre>
<button class="grey full" onclick="selectedDatesDemo()">Let's try that</button>
<script>
function selectedDatesDemo(){
datepicker.unselectAll();
datepicker.onClose = function(){
console.log(datepicker.selectedDates);
datepicker.onClose = null;
}
datepicker.show();
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="isOpen">
<h2>isOpen <span>Status</span> <a href="#index">Go up</a></h2>
<pre>
<code>
/*Get isOpen*/<br>
console.log(datepicker.isOpen);
</code>
</pre>
<button class="grey full" onclick="isOpenDemo()">Let's try that</button>
<script>
function isOpenDemo(){
console.log(datepicker.isOpen);
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="show">
<h2>show() <span>Function</span> <a href="#index">Go up</a></h2>
<pre>
<code>
/*Show datepicker*/<br>
datepicker.show({<br>
today:false<br>
});
</code>
</pre>
<button class="grey full" onclick="showDemo()">Let's try that</button>
<p><i class="fa fa-lightbulb-o hint"></i>You can pass all settings and callbacks as object</p>
<script>
function showDemo(){
datepicker.unselectAll();
datepicker.show({
today:false,
onClose:function(){
datepicker.onClose = null;
datepicker.today = true;
}
});
}
</script>
</div>
<div class="col-xs-12 col-md-6 block" id="hide">
<h2>hide() <span>Function</span> <a href="#index">Go up</a></h2>
<pre>
<code>
/*Hide datepicker*/<br>