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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>Checkboxes and radio buttons customization (jQuery and Zepto) plugin</title>
<meta charset="utf-8">
<meta content="width=device-width" name="viewport">
<link href="./css/custom.css?v=1.0.2" rel="stylesheet">
<link href="../skins/all.css?v=1.0.2" rel="stylesheet">
<script src="./js/jquery.js"></script>
<script src="../icheck.js?v=1.0.2"></script>
<script src="./js/custom.min.js?v=1.0.2"></script>
</head>
<body>
<div class="layout clear">
<div class="header">
<h1>super customized checkboxes and radio buttons for jQuery & Zepto</h1>
<h3>iCheck <span>v1.0.2</span></h3>
<strong>@<a href="http://twitter.com/fronteed/">Fronteed</a></strong>
</div>
<div class="features">
<div class="arrows">
<div class="bottom" data-to="demo"></div>
</div>
<h2>Plugin features</h2>
<ul>
<li>
<strong>Identical inputs across different browsers and devices</strong> — both <span class="self" data-to="download">desktop and mobile</span>
</li>
<li>
<strong>Touch devices support</strong> — iOS, Android, BlackBerry, Windows Phone, Amazon Kindle
</li>
<li>
<strong>Keyboard accessible inputs</strong> — <span class="mark">Tab</span>, <span class="mark">Spacebar</span>, <span class="mark">Arrow up/down</span> and other shortcuts
</li>
<li>
<strong>Screenreader accessible inputs</strong> — <a href="https://developer.mozilla.org/en-US/docs/Accessibility/ARIA" target="blank">ARIA</a> attributes for VoiceOver and others
</li>
<li>
<strong>Customization freedom</strong> — use any HTML and CSS to style inputs (try <span class="self" data-to="skins">6 Retina-ready skins</span>)
</li>
<li>
<strong>jQuery and Zepto</strong> JavaScript libraries support from single file
</li>
<li>
<strong>Lightweight size</strong> — 1 kb gzipped
</li>
<li class="offset">
<strong class="self" data-to="options">32 options</strong> to customize checkboxes and radio buttons
</li>
<li>
<strong class="self" data-to="callbacks">11 callbacks</strong> to handle changes
</li>
<li>
<strong class="self" data-to="methods">9 methods</strong> to make changes programmatically
</li>
<li>
Saves changes to original inputs, <span class="self" data-to="init">works carefully</span> with any selectors
</li>
</ul>
</div>
<div class="social clear">
<ul class="left">
<li>
<a href="http://github.com/fronteed/iCheck/">Download latest version</a>
</li>
</ul>
<ul class="right local">
<li>
<a href="http://twitter.com/fronteed/">Follow @fronteed</a>
</li>
<li>
<a href="https://twitter.com/intent/tweet?text=Highly customizable checkboxes and radio buttons&url=http://fronteed.com/iCheck/&via=fronteed&hashtags=jQuery,Zepto">Share on Twitter</a>
</li>
<li>
<a href="https://github.com/fronteed/iCheck">Star on GitHub</a>
</li>
</ul>
</div>
<div class="demo-holder">
<h2 class="demo-title">Demo</h2>
<div class="demo">
<div class="arrows">
<div class="top" data-to="features"></div>
<div class="bottom" data-to="skins"></div>
</div>
<div class="demo-list clear">
<ul>
<li>
<input tabindex="1" type="checkbox" id="input-1">
<label for="input-1">Checkbox, <span>#input-1</span></label>
</li>
<li>
<input tabindex="2" type="checkbox" id="input-2" checked>
<label for="input-2">Checkbox, <span>#input-2</span></label>
</li>
</ul>
<ul>
<li>
<input tabindex="3" type="radio" id="input-3" name="demo-radio">
<label for="input-3">Radio button, <span>#input-3</span></label>
</li>
<li>
<input tabindex="4" type="radio" id="input-4" name="demo-radio" checked>
<label for="input-4">Radio button, <span>#input-4</span></label>
</li>
</ul>
<script>
$(document).ready(function(){
var callbacks_list = $('.demo-callbacks ul');
$('.demo-list input').on('ifCreated ifClicked ifChanged ifChecked ifUnchecked ifDisabled ifEnabled ifDestroyed', function(event){
callbacks_list.prepend('<li><span>#' + this.id + '</span> is ' + event.type.replace('if', '').toLowerCase() + '</li>');
}).iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%'
});
});
</script>
</div>
<dl class="demo-methods">
<dt>
<span class="self do-check">Add <span class="mark">checked</span> state to 1 and 3 inputs</span>
<span class="code">
<span class="self">show code</span>
</span>
</dt>
<dd>
<pre class="markup">
$('#input-1, #input-3').iCheck('check');
</pre>
</dd>
<dt>
<span class="self do-uncheck">Remove <span class="mark">checked</span> state from 1 and 3 inputs</span>
<span class="code">
<span class="self">show code</span>
</span>
</dt>
<dd>
<pre class="markup">
$('#input-1, #input-3').iCheck('uncheck');
</pre>
</dd>
<dt>
<span class="self do-disable">Add <span class="mark">disabled</span> state to 2 and 4 inputs</span>
<span class="code">
<span class="self">show code</span>
</span>
</dt>
<dd>
<pre class="markup">
$('#input-2, #input-4').iCheck('disable');
</pre>
</dd>
<dt>
<span class="self do-enable">Remove <span class="mark">disabled</span> state from 2 and 4 inputs</span>
<span class="code">
<span class="self">show code</span>
</span>
</dt>
<dd>
<pre class="markup">
$('#input-2, #input-4').iCheck('enable');
</pre>
</dd>
<dt>
<span class="self do-destroy">Remove all traces of iCheck</span>
<span class="code">
<span class="self">show code</span>
</span>
</dt>
<dd>
<pre class="markup">
$('input').iCheck('destroy');
</pre>
</dd>
</dl>
<div class="demo-callbacks">
<h2>Callbacks</h2>
<ul></ul>
</div>
</div>
</div>
<div class="skins">
<h2>Skins</h2>
<div class="skin skin-minimal">
<div class="arrows">
<div class="top" data-to="demo"></div>
<div class="bottom" data-to="skin-square"></div>
</div>
<h3>Minimal skin</h3>
<dl class="clear">
<dd class="selected">
<div class="skin-section">
<h4>Live</h4>
<ul class="list">
<li>
<input tabindex="5" type="checkbox" id="minimal-checkbox-1">
<label for="minimal-checkbox-1">Checkbox 1</label>
</li>
<li>
<input tabindex="6" type="checkbox" id="minimal-checkbox-2" checked>
<label for="minimal-checkbox-2">Checkbox 2</label>
</li>
<li>
<input type="checkbox" id="minimal-checkbox-disabled" disabled>
<label for="minimal-checkbox-disabled">Disabled</label>
</li>
<li>
<input type="checkbox" id="minimal-checkbox-disabled-checked" checked disabled>
<label for="minimal-checkbox-disabled-checked">Disabled & checked</label>
</li>
</ul>
<ul class="list">
<li>
<input tabindex="7" type="radio" id="minimal-radio-1" name="minimal-radio">
<label for="minimal-radio-1">Radio button 1</label>
</li>
<li>
<input tabindex="8" type="radio" id="minimal-radio-2" name="minimal-radio" checked>
<label for="minimal-radio-2">Radio button 2</label>
</li>
<li>
<input type="radio" id="minimal-radio-disabled" disabled>
<label for="minimal-radio-disabled">Disabled</label>
</li>
<li>
<input type="radio" id="minimal-radio-disabled-checked" checked disabled>
<label for="minimal-radio-disabled-checked">Disabled & checked</label>
</li>
</ul>
<div class="colors clear">
<strong>Color schemes</strong>
<ul>
<li class="active" title="Black"></li>
<li class="red" title="Red"></li>
<li class="green" title="Green"></li>
<li class="blue" title="Blue"></li>
<li class="aero" title="Aero"></li>
<li class="grey" title="Grey"></li>
<li class="orange" title="Orange"></li>
<li class="yellow" title="Yellow"></li>
<li class="pink" title="Pink"></li>
<li class="purple" title="Purple"></li>
</ul>
</div>
</div>
<div class="skin-section skin-states">
<h4>States</h4>
<ul class="list">
<li>
<div class="state icheckbox_minimal"></div>
<div class="state iradio_minimal"></div>
Normal
</li>
<li>
<div class="state icheckbox_minimal hover"></div>
<div class="state iradio_minimal hover"></div>
Hover
</li>
<li>
<div class="state icheckbox_minimal checked"></div>
<div class="state iradio_minimal checked"></div>
Checked
</li>
<li>
<div class="state icheckbox_minimal disabled"></div>
<div class="state iradio_minimal disabled"></div>
Disabled
</li>
<li>
<div class="state icheckbox_minimal checked disabled"></div>
<div class="state iradio_minimal checked disabled"></div>
Disabled & checked
</li>
</ul>
</div>
<script>
$(document).ready(function(){
$('.skin-minimal input').iCheck({
checkboxClass: 'icheckbox_minimal',
radioClass: 'iradio_minimal',
increaseArea: '20%'
});
});
</script>
</dd>
<dt class="selected">Demo</dt>
<dd>
<div class="skin-pre">
<p>
Make sure <a href="http://jquery.com" target="blank">jQuery v1.7+</a> (or <a href="http://github.com/madrobby/zepto#zepto-modules" target="blank">Zepto</a> [polyfill, event, data]) is loaded before the <span class="mark">icheck.js</span>.
</p>
</div>
<ol class="skin-usage">
<li>
Choose a color scheme, there are 10 different styles available:
<div class="schemes clear">
<ul>
<li><strong>Black</strong> — minimal.css</li>
<li><strong>Red</strong> — red.css</li>
<li><strong>Green</strong> — green.css</li>
<li><strong>Blue</strong> — blue.css</li>
<li><strong>Aero</strong> — aero.css</li>
</ul>
<ul>
<li><strong>Grey</strong> — grey.css</li>
<li><strong>Orange</strong> — orange.css</li>
<li><strong>Yellow</strong> — yellow.css</li>
<li><strong>Pink</strong> — pink.css</li>
<li><strong>Purple</strong> — purple.css</li>
</ul>
</div>
</li>
<li>
Copy <span class="mark">/skins/minimal/</span> folder and <span class="mark">icheck.js</span> file to your site.
</li>
<li>
<p>Insert before <span class="mark"></head></span> in your HTML (replace <span class="mark">your-path</span> and <span class="mark">color-scheme</span>):</p>
<pre class="markup">
<link href="your-path/minimal/color-scheme.css" rel="stylesheet">
<script src="your-path/icheck.js"></script>
</pre>
<p>Example for a <strong>Red</strong> color scheme:</p>
<pre class="markup">
<link href="your-path/minimal/red.css" rel="stylesheet">
<script src="your-path/icheck.js"></script>
</pre>
</li>
<li>
<p>Add some checkboxes and radio buttons to your HTML:</p>
<pre class="markup">
<input type="checkbox">
<input type="checkbox" checked>
<input type="radio" name="iCheck">
<input type="radio" name="iCheck" checked>
</pre>
</li>
<li>
<p>Add JavaScript to your HTML to launch iCheck plugin:</p>
<pre class="markup">
<script>
$(document).ready(function(){
$('input').iCheck({
checkboxClass: 'icheckbox_minimal',
radioClass: 'iradio_minimal',
increaseArea: '20%' <span class="comment">// optional</span>
});
});
</script>
</pre>
<p>For different from black color schemes use this code (example for <strong>Red</strong>):</p>
<pre class="markup">
<script>
$(document).ready(function(){
$('input').iCheck({
checkboxClass: 'icheckbox_minimal-red',
radioClass: 'iradio_minimal-red',
increaseArea: '20%' <span class="comment">// optional</span>
});
});
</script>
</pre>
</li>
<li>Done.</li>
</ol>
</dd>
<dt>Usage</dt>
</dl>
</div>
<div class="skin skin-square">
<div class="arrows">
<div class="top" data-to="skin-minimal"></div>
<div class="bottom" data-to="skin-flat"></div>
</div>
<h3>Square skin</h3>
<dl class="clear">
<dd class="selected">
<div class="skin-section">
<h4>Live</h4>
<ul class="list">
<li>
<input tabindex="9" type="checkbox" id="square-checkbox-1">
<label for="square-checkbox-1">Checkbox 1</label>
</li>
<li>
<input tabindex="10" type="checkbox" id="square-checkbox-2" checked>
<label for="square-checkbox-2">Checkbox 2</label>
</li>
<li>
<input type="checkbox" id="square-checkbox-disabled" disabled>
<label for="square-checkbox-disabled">Disabled</label>
</li>
<li>
<input type="checkbox" id="square-checkbox-disabled-checked" checked disabled>
<label for="square-checkbox-disabled-checked">Disabled & checked</label>
</li>
</ul>
<ul class="list">
<li>
<input tabindex="11" type="radio" id="square-radio-1" name="square-radio">
<label for="square-radio-1">Radio button 1</label>
</li>
<li>
<input tabindex="12" type="radio" id="square-radio-2" name="square-radio" checked>
<label for="square-radio-2">Radio button 2</label>
</li>
<li>
<input type="radio" id="square-radio-disabled" disabled>
<label for="square-radio-disabled">Disabled</label>
</li>
<li>
<input type="radio" id="square-radio-disabled-checked" checked disabled>
<label for="square-radio-disabled-checked">Disabled & checked</label>
</li>
</ul>
<div class="colors clear">
<strong>Color schemes</strong>
<ul>
<li title="Black"></li>
<li class="red" title="Red"></li>
<li class="green active" title="Green"></li>
<li class="blue" title="Blue"></li>
<li class="aero" title="Aero"></li>
<li class="grey" title="Grey"></li>
<li class="orange" title="Orange"></li>
<li class="yellow" title="Yellow"></li>
<li class="pink" title="Pink"></li>
<li class="purple" title="Purple"></li>
</ul>
</div>
</div>
<div class="skin-section skin-states">
<h4>States</h4>
<ul class="list">
<li>
<div class="state icheckbox_square-green"></div>
<div class="state iradio_square-green"></div>
Normal
</li>
<li>
<div class="state icheckbox_square-green hover"></div>
<div class="state iradio_square-green hover"></div>
Hover
</li>
<li>
<div class="state icheckbox_square-green checked"></div>
<div class="state iradio_square-green checked"></div>
Checked
</li>
<li>
<div class="state icheckbox_square-green disabled"></div>
<div class="state iradio_square-green disabled"></div>
Disabled
</li>
<li>
<div class="state icheckbox_square-green checked disabled"></div>
<div class="state iradio_square-green checked disabled"></div>
Disabled & checked
</li>
</ul>
</div>
<script>
$(document).ready(function(){
$('.skin-square input').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
increaseArea: '20%'
});
});
</script>
</dd>
<dt class="selected">Demo</dt>
<dd>
<div class="skin-pre">
<p>
Make sure <a href="http://jquery.com" target="blank">jQuery v1.7+</a> (or <a href="http://github.com/madrobby/zepto#zepto-modules" target="blank">Zepto</a> [polyfill, event, data]) is loaded before the <span class="mark">icheck.js</span>.
</p>
</div>
<ol class="skin-usage">
<li>
Choose a color scheme, there are 10 different styles available:
<div class="schemes clear">
<ul>
<li><strong>Black</strong> — square.css</li>
<li><strong>Red</strong> — red.css</li>
<li><strong>Green</strong> — green.css</li>
<li><strong>Blue</strong> — blue.css</li>
<li><strong>Aero</strong> — aero.css</li>
</ul>
<ul>
<li><strong>Grey</strong> — grey.css</li>
<li><strong>Orange</strong> — orange.css</li>
<li><strong>Yellow</strong> — yellow.css</li>
<li><strong>Pink</strong> — pink.css</li>
<li><strong>Purple</strong> — purple.css</li>
</ul>
</div>
</li>
<li>
Copy <span class="mark">/skins/square/</span> folder and <span class="mark">icheck.js</span> file to your site.
</li>
<li>
<p>Insert before <span class="mark"></head></span> in your HTML (replace <span class="mark">your-path</span> and <span class="mark">color-scheme</span>):</p>
<pre class="markup">
<link href="your-path/square/color-scheme.css" rel="stylesheet">
<script src="your-path/icheck.js"></script>
</pre>
<p>Example for a <strong>Red</strong> color scheme:</p>
<pre class="markup">
<link href="your-path/square/red.css" rel="stylesheet">
<script src="your-path/icheck.js"></script>
</pre>
</li>
<li>
<p>Add some checkboxes and radio buttons to your HTML:</p>
<pre class="markup">
<input type="checkbox">
<input type="checkbox" checked>
<input type="radio" name="iCheck">
<input type="radio" name="iCheck" checked>
</pre>
</li>
<li>
<p>Add JavaScript to your HTML to launch iCheck plugin:</p>
<pre class="markup">
<script>
$(document).ready(function(){
$('input').iCheck({
checkboxClass: 'icheckbox_square',
radioClass: 'iradio_square',
increaseArea: '20%' <span class="comment">// optional</span>
});
});
</script>
</pre>
<p>For different from black color schemes use this code (example for <strong>Red</strong>):</p>
<pre class="markup">
<script>
$(document).ready(function(){
$('input').iCheck({
checkboxClass: 'icheckbox_square-red',
radioClass: 'iradio_square-red',
increaseArea: '20%' <span class="comment">// optional</span>
});
});
</script>
</pre>
</li>
<li>Done.</li>
</ol>
</dd>
<dt>Usage</dt>
</dl>
</div>
<div class="skin skin-flat">
<div class="arrows">
<div class="top" data-to="skin-square"></div>
<div class="bottom" data-to="skin-line"></div>
</div>
<h3>Flat skin</h3>
<dl class="clear">
<dd class="selected">
<div class="skin-section">
<h4>Live</h4>
<ul class="list">
<li>
<input tabindex="13" type="checkbox" id="flat-checkbox-1">
<label for="flat-checkbox-1">Checkbox 1</label>
</li>
<li>
<input tabindex="14" type="checkbox" id="flat-checkbox-2" checked>
<label for="flat-checkbox-2">Checkbox 2</label>
</li>
<li>
<input type="checkbox" id="flat-checkbox-disabled" disabled>
<label for="flat-checkbox-disabled">Disabled</label>
</li>
<li>
<input type="checkbox" id="flat-checkbox-disabled-checked" checked disabled>
<label for="flat-checkbox-disabled-checked">Disabled & checked</label>
</li>
</ul>
<ul class="list">
<li>
<input tabindex="15" type="radio" id="flat-radio-1" name="flat-radio">
<label for="flat-radio-1">Radio button 1</label>
</li>
<li>
<input tabindex="16" type="radio" id="flat-radio-2" name="flat-radio" checked>
<label for="flat-radio-2">Radio button 2</label>
</li>
<li>
<input type="radio" id="flat-radio-disabled" disabled>
<label for="flat-radio-disabled">Disabled</label>
</li>
<li>
<input type="radio" id="flat-radio-disabled-checked" checked disabled>
<label for="flat-radio-disabled-checked">Disabled & checked</label>
</li>
</ul>
<div class="colors clear">
<strong>Color schemes</strong>
<ul>
<li title="Black"></li>
<li class="red active" title="Red"></li>
<li class="green" title="Green"></li>
<li class="blue" title="Blue"></li>
<li class="aero" title="Aero"></li>
<li class="grey" title="Grey"></li>
<li class="orange" title="Orange"></li>
<li class="yellow" title="Yellow"></li>
<li class="pink" title="Pink"></li>
<li class="purple" title="Purple"></li>
</ul>
</div>
</div>
<div class="skin-section skin-states">
<h4>States</h4>
<ul class="list">
<li>
<div class="state icheckbox_flat-red"></div>
<div class="state iradio_flat-red"></div>
Normal
</li>
<li>
<div class="state icheckbox_flat-red checked"></div>
<div class="state iradio_flat-red checked"></div>
Checked
</li>
<li>
<div class="state icheckbox_flat-red disabled"></div>
<div class="state iradio_flat-red disabled"></div>
Disabled
</li>
<li>
<div class="state icheckbox_flat-red checked disabled"></div>
<div class="state iradio_flat-red checked disabled"></div>
Disabled & checked
</li>
</ul>
</div>
<script>
$(document).ready(function(){
$('.skin-flat input').iCheck({
checkboxClass: 'icheckbox_flat-red',
radioClass: 'iradio_flat-red'
});
});
</script>
</dd>
<dt class="selected">Demo</dt>
<dd>
<div class="skin-pre">
<p>
Make sure <a href="http://jquery.com" target="blank">jQuery v1.7+</a> (or <a href="http://github.com/madrobby/zepto#zepto-modules" target="blank">Zepto</a> [polyfill, event, data]) is loaded before the <span class="mark">icheck.js</span>.
</p>
</div>
<ol class="skin-usage">
<li>
Choose a color scheme, there are 10 different styles available:
<div class="schemes clear">
<ul>
<li><strong>Black</strong> — flat.css</li>
<li><strong>Red</strong> — red.css</li>
<li><strong>Green</strong> — green.css</li>
<li><strong>Blue</strong> — blue.css</li>
<li><strong>Aero</strong> — aero.css</li>
</ul>
<ul>
<li><strong>Grey</strong> — grey.css</li>
<li><strong>Orange</strong> — orange.css</li>
<li><strong>Yellow</strong> — yellow.css</li>
<li><strong>Pink</strong> — pink.css</li>
<li><strong>Purple</strong> — purple.css</li>
</ul>
</div>
</li>
<li>
Copy <span class="mark">/skins/flat/</span> folder and <span class="mark">icheck.js</span> file to your site.
</li>
<li>
<p>Insert before <span class="mark"></head></span> in your HTML (replace <span class="mark">your-path</span> and <span class="mark">color-scheme</span>):</p>
<pre class="markup">
<link href="your-path/flat/color-scheme.css" rel="stylesheet">
<script src="your-path/icheck.js"></script>
</pre>
<p>Example for a <strong>Red</strong> color scheme:</p>
<pre class="markup">
<link href="your-path/flat/red.css" rel="stylesheet">
<script src="your-path/icheck.js"></script>
</pre>
</li>
<li>
<p>Add some checkboxes and radio buttons to your HTML:</p>
<pre class="markup">
<input type="checkbox">
<input type="checkbox" checked>
<input type="radio" name="iCheck">
<input type="radio" name="iCheck" checked>
</pre>
</li>
<li>
<p>Add JavaScript to your HTML to launch iCheck plugin:</p>
<pre class="markup">
<script>
$(document).ready(function(){
$('input').iCheck({
checkboxClass: 'icheckbox_flat',
radioClass: 'iradio_flat'
});
});
</script>
</pre>
<p>For different from black color schemes use this code (example for <strong>Red</strong>):</p>
<pre class="markup">
<script>
$(document).ready(function(){
$('input').iCheck({
checkboxClass: 'icheckbox_flat-red',
radioClass: 'iradio_flat-red'
});
});
</script>
</pre>
</li>
<li>Done.</li>
</ol>
</dd>
<dt>Usage</dt>
</dl>
</div>
<div class="skin skin-line">
<div class="arrows">
<div class="top" data-to="skin-flat"></div>
<div class="bottom" data-to="skin-polaris"></div>
</div>
<h3>Line skin</h3>
<dl class="clear">
<dd class="selected">
<div class="skin-section">
<h4>Live</h4>
<ul class="list">
<li>
<input tabindex="17" type="checkbox" id="line-checkbox-1">
<label for="line-checkbox-1">Checkbox 1</label>
</li>
<li>
<input tabindex="18" type="checkbox" id="line-checkbox-2" checked>
<label for="line-checkbox-2">Checkbox 2</label>
</li>
<li>
<input type="checkbox" id="line-checkbox-disabled" disabled>
<label for="line-checkbox-disabled">Disabled</label>
</li>
<li>
<input type="checkbox" id="line-checkbox-disabled-checked" checked disabled>
<label for="line-checkbox-disabled-checked">Disabled & checked</label>
</li>
</ul>
<ul class="list">
<li>
<input tabindex="19" type="radio" id="line-radio-1" name="line-radio">
<label for="line-radio-1">Radio button 1</label>
</li>
<li>
<input tabindex="20" type="radio" id="line-radio-2" name="line-radio" checked>
<label for="line-radio-2">Radio button 2</label>
</li>
<li>
<input type="radio" id="line-radio-disabled" disabled>
<label for="line-radio-disabled">Disabled</label>
</li>
<li>
<input type="radio" id="line-radio-disabled-checked" checked disabled>
<label for="line-radio-disabled-checked">Disabled & checked</label>
</li>
</ul>
<div class="colors clear">
<strong>Color schemes</strong>
<ul>
<li title="Black"></li>
<li class="red" title="Red"></li>
<li class="green" title="Green"></li>
<li class="blue active" title="Blue"></li>
<li class="aero" title="Aero"></li>
<li class="grey" title="Grey"></li>
<li class="orange" title="Orange"></li>
<li class="yellow" title="Yellow"></li>
<li class="pink" title="Pink"></li>
<li class="purple" title="Purple"></li>
</ul>
</div>
</div>
<div class="skin-section skin-states">
<h4>States</h4>
<ul class="list">
<li>
<div class="state icheckbox_line-blue">
<div class="icheck_line-icon"></div>
Normal
</div>
</li>
<li>
<div class="state icheckbox_line-blue hover">
<div class="icheck_line-icon"></div>
Hover
</div>
</li>
<li>
<div class="state icheckbox_line-blue checked">
<div class="icheck_line-icon"></div>
Checked
</div>
</li>
<li>
<div class="state icheckbox_line-blue disabled">
<div class="icheck_line-icon"></div>
Disabled
</div>
</li>
<li>
<div class="state icheckbox_line-blue checked disabled">
<div class="icheck_line-icon"></div>
Disabled & checked
</div>
</li>
</ul>
</div>
<script>
$(document).ready(function(){
$('.skin-line input').each(function(){
var self = $(this),
label = self.next(),
label_text = label.text();
label.remove();
self.iCheck({
checkboxClass: 'icheckbox_line-blue',
radioClass: 'iradio_line-blue',
insert: '<div class="icheck_line-icon"></div>' + label_text
});
});
});
</script>
</dd>
<dt class="selected">Demo</dt>
<dd>
<div class="skin-pre">
<p>
Make sure <a href="http://jquery.com" target="blank">jQuery v1.7+</a> (or <a href="http://github.com/madrobby/zepto#zepto-modules" target="blank">Zepto</a> [polyfill, event, data]) is loaded before the <span class="mark">icheck.js</span>.
</p>
</div>
<ol class="skin-usage">
<li>
Choose a color scheme, there are 10 different styles available:
<div class="schemes clear">
<ul>
<li><strong>Black</strong> — line.css</li>
<li><strong>Red</strong> — red.css</li>
<li><strong>Green</strong> — green.css</li>
<li><strong>Blue</strong> — blue.css</li>
<li><strong>Aero</strong> — aero.css</li>
</ul>
<ul>
<li><strong>Grey</strong> — grey.css</li>
<li><strong>Orange</strong> — orange.css</li>
<li><strong>Yellow</strong> — yellow.css</li>
<li><strong>Pink</strong> — pink.css</li>
<li><strong>Purple</strong> — purple.css</li>
</ul>
</div>
</li>
<li>
Copy <span class="mark">/skins/line/</span> folder and <span class="mark">icheck.js</span> file to your site.
</li>
<li>
<p>Insert before <span class="mark"></head></span> in your HTML (replace <span class="mark">your-path</span> and <span class="mark">color-scheme</span>):</p>
<pre class="markup">
<link href="your-path/line/color-scheme.css" rel="stylesheet">
<script src="your-path/icheck.js"></script>
</pre>
<p>Example for a <strong>Red</strong> color scheme:</p>
<pre class="markup">
<link href="your-path/line/red.css" rel="stylesheet">
<script src="your-path/icheck.js"></script>
</pre>
</li>
<li>
<p>Add some checkboxes, radio buttons and labels to your HTML:</p>
<pre class="markup">
<input type="checkbox">
<label>Checkbox 1</label>
<input type="checkbox" checked>
<label>Checkbox 2</label>
<input type="radio" name="iCheck">
<label>Radio button 1</label>
<input type="radio" name="iCheck" checked>
<label>Radio button 2</label>
</pre>
</li>
<li>
<p>Add JavaScript to your HTML to launch iCheck plugin:</p>
<pre class="markup">
<script>
$(document).ready(function(){
$('input').each(function(){
var self = $(this),
label = self.next(),
label_text = label.text();
label.remove();
self.iCheck({
checkboxClass: 'icheckbox_line',
radioClass: 'iradio_line',
insert: '<div class="icheck_line-icon"></div>' + label_text
});
});
});
</script>
</pre>
<p>For different from black color schemes use this code (example for <strong>Red</strong>):</p>
<pre class="markup">
<script>
$(document).ready(function(){
$('input').each(function(){
var self = $(this),
label = self.next(),
label_text = label.text();
label.remove();
self.iCheck({
checkboxClass: 'icheckbox_line-red',
radioClass: 'iradio_line-red',
insert: '<div class="icheck_line-icon"></div>' + label_text
});
});
});
</script>
</pre>
</li>
<li>Done.</li>
</ol>
</dd>
<dt>Usage</dt>
</dl>
</div>
<div class="skin skin-polaris">
<div class="arrows">
<div class="top" data-to="skin-line"></div>
<div class="bottom" data-to="skin-futurico"></div>
</div>
<h3>Polaris skin</h3>
<dl class="clear">
<dd class="selected">
<div class="skin-section">
<h4>Live</h4>
<ul class="list">
<li>
<input tabindex="21" type="checkbox" id="polaris-checkbox-1">
<label for="polaris-checkbox-1">Checkbox 1</label>
</li>
<li>
<input tabindex="22" type="checkbox" id="polaris-checkbox-2" checked>
<label for="polaris-checkbox-2">Checkbox 2</label>
</li>
<li>
<input type="checkbox" id="polaris-checkbox-disabled" disabled>
<label for="polaris-checkbox-disabled">Disabled</label>
</li>
<li>
<input type="checkbox" id="polaris-checkbox-disabled-checked" checked disabled>
<label for="polaris-checkbox-disabled-checked">Disabled & checked</label>
</li>
</ul>
<ul class="list">
<li>
<input tabindex="23" type="radio" id="polaris-radio-1" name="polaris-radio">
<label for="polaris-radio-1">Radio button 1</label>
</li>
<li>
<input tabindex="24" type="radio" id="polaris-radio-2" name="polaris-radio" checked>
<label for="polaris-radio-2">Radio button 2</label>
</li>
<li>
<input type="radio" id="polaris-radio-disabled" disabled>
<label for="polaris-radio-disabled">Disabled</label>
</li>
<li>
<input type="radio" id="polaris-radio-disabled-checked" checked disabled>
<label for="polaris-radio-disabled-checked">Disabled & checked</label>
</li>
</ul>
</div>
<div class="skin-section skin-states">
<h4>States</h4>
<ul class="list">
<li>
<div class="state icheckbox_polaris"></div>
<div class="state iradio_polaris"></div>
Normal
</li>
<li>
<div class="state icheckbox_polaris hover"></div>
<div class="state iradio_polaris hover"></div>
Hover
</li>
<li>
<div class="state icheckbox_polaris checked"></div>
<div class="state iradio_polaris checked"></div>
Checked
</li>
<li>
<div class="state icheckbox_polaris disabled"></div>
<div class="state iradio_polaris disabled"></div>
Disabled
</li>
<li>
<div class="state icheckbox_polaris checked disabled"></div>
<div class="state iradio_polaris checked disabled"></div>
Disabled & checked
</li>
</ul>
</div>
<script>
$(document).ready(function(){
$('.skin-polaris input').iCheck({
checkboxClass: 'icheckbox_polaris',
radioClass: 'iradio_polaris',
increaseArea: '-10%'
});
});
</script>
</dd>
<dt class="selected">Demo</dt>
<dd>
<div class="skin-pre">
<p>
Make sure <a href="http://jquery.com" target="blank">jQuery v1.7+</a> (or <a href="http://github.com/madrobby/zepto#zepto-modules" target="blank">Zepto</a> [polyfill, event, data]) is loaded before the <span class="mark">icheck.js</span>.
</p>
</div>
<ol class="skin-usage">
<li>
Copy <span class="mark">/skins/polaris/</span> folder and <span class="mark">icheck.js</span> file to your site.
</li>
<li>
<p>Insert before <span class="mark"></head></span> in your HTML (replace <span class="mark">your-path</span> and <span class="mark">color-scheme</span>):</p>
<pre class="markup">
<link href="your-path/polaris/polaris.css" rel="stylesheet">
<script src="your-path/icheck.js"></script>
</pre>
</li>
<li>
<p>Add some checkboxes and radio buttons to your HTML:</p>
<pre class="markup">
<input type="checkbox">
<input type="checkbox" checked>
<input type="radio" name="iCheck">
<input type="radio" name="iCheck" checked>
</pre>
</li>
<li>
<p>Add JavaScript to your HTML to launch iCheck plugin:</p>
<pre class="markup">
<script>
$(document).ready(function(){
$('input').iCheck({
checkboxClass: 'icheckbox_polaris',
radioClass: 'iradio_polaris',
increaseArea: '-10%' <span class="comment">// optional</span>
});
});
</script>
</pre>
</li>
<li>Done.</li>
</ol>
</dd>
<dt>Usage</dt>
</dl>
</div>
<div class="skin skin-futurico">
<div class="arrows">
<div class="top" data-to="skin-polaris"></div>
<div class="bottom" data-to="usage"></div>
</div>
<h3>Futurico skin</h3>
<dl class="clear">
<dd class="selected">
<div class="skin-section">
<h4>Live</h4>
<ul class="list">
<li>
<input tabindex="25" type="checkbox" id="futurico-checkbox-1">
<label for="futurico-checkbox-1">Checkbox 1</label>
</li>
<li>
<input tabindex="26" type="checkbox" id="futurico-checkbox-2" checked>
<label for="futurico-checkbox-2">Checkbox 2</label>
</li>
<li>
<input type="checkbox" id="futurico-checkbox-disabled" disabled>
<label for="futurico-checkbox-disabled">Disabled</label>
</li>
<li>
<input type="checkbox" id="futurico-checkbox-disabled-checked" checked disabled>
<label for="futurico-checkbox-disabled-checked">Disabled & checked</label>
</li>
</ul>
<ul class="list">
<li>
<input tabindex="27" type="radio" id="futurico-radio-1" name="futurico-radio">
<label for="futurico-radio-1">Radio button 1</label>
</li>
<li>
<input tabindex="28" type="radio" id="futurico-radio-2" name="futurico-radio" checked>
<label for="futurico-radio-2">Radio button 2</label>
</li>
<li>
<input type="radio" id="futurico-radio-disabled" disabled>
<label for="futurico-radio-disabled">Disabled</label>
</li>
<li>
<input type="radio" id="futurico-radio-disabled-checked" checked disabled>
<label for="futurico-radio-disabled-checked">Disabled & checked</label>
</li>
</ul>
</div>
<div class="skin-section skin-states">
<h4>States</h4>
<ul class="list">
<li>
<div class="state icheckbox_futurico"></div>
<div class="state iradio_futurico"></div>
Normal
</li>
<li>
<div class="state icheckbox_futurico checked"></div>
<div class="state iradio_futurico checked"></div>
Checked
</li>
<li>
<div class="state icheckbox_futurico disabled"></div>
<div class="state iradio_futurico disabled"></div>
Disabled
</li>
<li>
<div class="state icheckbox_futurico checked disabled"></div>
<div class="state iradio_futurico checked disabled"></div>
Disabled & checked
</li>
</ul>
</div>
<script>
$(document).ready(function(){
$('.skin-futurico input').iCheck({
checkboxClass: 'icheckbox_futurico',
radioClass: 'iradio_futurico',
increaseArea: '20%'
});
});
</script>
</dd>
<dt class="selected">Demo</dt>
<dd>
<div class="skin-pre">
<p>
Make sure <a href="http://jquery.com" target="blank">jQuery v1.7+</a> (or <a href="http://github.com/madrobby/zepto#zepto-modules" target="blank">Zepto</a> [polyfill, event, data]) is loaded before the <span class="mark">icheck.js</span>.
</p>
</div>
<ol class="skin-usage">
<li>
Copy <span class="mark">/skins/futurico/</span> folder and <span class="mark">icheck.js</span> file to your site.
</li>
<li>
<p>Insert before <span class="mark"></head></span> in your HTML (replace <span class="mark">your-path</span> and <span class="mark">color-scheme</span>):</p>
<pre class="markup">
<link href="your-path/futurico/futurico.css" rel="stylesheet">
<script src="your-path/icheck.js"></script>
</pre>
</li>
<li>
<p>Add some checkboxes and radio buttons to your HTML:</p>
<pre class="markup">
<input type="checkbox">
<input type="checkbox" checked>
<input type="radio" name="iCheck">
<input type="radio" name="iCheck" checked>
</pre>
</li>
<li>
<p>Add JavaScript to your HTML to launch iCheck plugin:</p>
<pre class="markup">
<script>
$(document).ready(function(){
$('input').iCheck({
checkboxClass: 'icheckbox_futurico',
radioClass: 'iradio_futurico',
increaseArea: '20%' <span class="comment">// optional</span>
});
});
</script>
</pre>
</li>
<li>Done.</li>
</ol>
</dd>
<dt>Usage</dt>
</dl>
</div>
<div class="skins-info">
<p>All skins (except Line) are transparent, you may use them on any background.</p>
<p><a href="http://designmodo.com/square/?u=718" target="blank">Square</a>, <a href="http://designmodo.com/flat/?u=718" target="blank">Flat</a>, <a href="http://designmodo.com/?u=718" target="blank">Polaris</a> and <a href="http://designmodo.com/futuricopro/?u=718" target="blank">Futurico</a> skins are based on <a href="http://designmodo.com/shop/?u=718" target="blank">Designmodo's UI packs</a>.</p>
<p class="skins-banner">
<a href="http://designmodo.com/shop/?u=718" target="blank">Awesome UI packs</a>
</p>
</div>
</div>
<div class="usage">
<div class="arrows">
<div class="top" data-to="skin-futurico"></div>
<div class="bottom" data-to="comparison"></div>
</div>
<h2>Simple usage</h2>
<div class="usage-inner">
<p>
iCheck plugin works with checkboxes and radio buttons like a constructor.
<br><strong>It wraps each input with a div</strong>, which may be customized by you or using one of the <span class="self" data-to="skins">available skins</span>.
<br>You may also place inside that div some HTML code or text using <span class="mark">insert</span> option.
</p>
<p class="offset">For this HTML:</p>
<pre class="markup">
<label>
<input type="checkbox" name="quux[1]" disabled>
Foo
</label>
<label for="baz[1]">Bar</label>
<input type="radio" name="quux[2]" id="baz[1]" checked>
<label for="baz[2]">Bar</label>
<input type="radio" name="quux[2]" id="baz[2]">
</pre>
<p class="offset">With default options you'll get nearly this:</p>
<pre class="markup">
<label>
<div class="icheckbox disabled">
<input type="checkbox" name="quux[1]" disabled>
</div>
Foo
</label>
<label for="baz[1]">Bar</label>
<div class="iradio checked">
<input type="radio" name="quux[2]" id="baz[1]" checked>
</div>
<label for="baz[2]">Bar</label>
<div class="iradio">
<input type="radio" name="quux[2]" id="baz[2]">
</div>
</pre>
<p><strong>By default, iCheck doesn't provide any CSS styles for wrapper divs</strong> (if you don't use <span class="self" data-to="skins">skins</span>).</p>
<h4 class="options">Options</h4>
<p>These options are default:</p>
<pre class="markup">
{
<span class="comment">// 'checkbox' or 'radio' to style only checkboxes or radio buttons, both by default</span>
handle: '',
<span class="comment">// base class added to customized checkboxes</span>
checkboxClass: 'icheckbox',
<span class="comment">// base class added to customized radio buttons</span>
radioClass: 'iradio',
<span class="comment">// class added on checked state (input.checked = true)</span>
checkedClass: 'checked',
<span class="comment">// if not empty, used instead of 'checkedClass' option (input type specific)</span>
checkedCheckboxClass: '',
checkedRadioClass: '',
<span class="comment">// if not empty, added as class name on unchecked state (input.checked = false)</span>
uncheckedClass: '',
<span class="comment">// if not empty, used instead of 'uncheckedClass' option (input type specific)</span>
uncheckedCheckboxClass: '',
uncheckedRadioClass: '',
<span class="comment">// class added on disabled state (input.disabled = true)</span>
disabledClass: 'disabled',
<span class="comment">// if not empty, used instead of 'disabledClass' option (input type specific)</span>
disabledCheckboxClass: '',
disabledRadioClass: '',
<span class="comment">// if not empty, added as class name on enabled state (input.disabled = false)</span>
enabledClass: '',
<span class="comment">// if not empty, used instead of 'enabledClass' option (input type specific)</span>
enabledCheckboxClass: '',
enabledRadioClass: '',
<span class="comment">// class added on <span class="self" data-to="indeterminate">indeterminate state</span> (input.indeterminate = true)</span>
indeterminateClass: 'indeterminate',
<span class="comment">// if not empty, used instead of 'indeterminateClass' option (input type specific)</span>
indeterminateCheckboxClass: '',
indeterminateRadioClass: '',
<span class="comment">// if not empty, added as class name on determinate state (input.indeterminate = false)</span>
determinateClass: '',
<span class="comment">// if not empty, used instead of 'determinateClass' option (input type specific)</span>
determinateCheckboxClass: '',
determinateRadioClass: '',
<span class="comment">// class added on hover state (pointer is moved onto input)</span>
hoverClass: 'hover',
<span class="comment">// class added on focus state (input has gained focus)</span>
focusClass: 'focus',
<span class="comment">// class added on active state (mouse button is pressed on input)</span>
activeClass: 'active',
<span class="comment">// adds hoverClass to customized input on label hover and labelHoverClass to label on input hover</span>
labelHover: true,
<span class="comment">// class added to label if labelHover set to true</span>
labelHoverClass: 'hover',
<span class="comment">// increase clickable area by given % (negative number to decrease)</span>
increaseArea: '',
<span class="comment">// true to set 'pointer' CSS cursor over enabled inputs and 'default' over disabled</span>
cursor: false,
<span class="comment">// set true to inherit original input's class name</span>
inheritClass: false,
<span class="comment">// if set to true, input's id is prefixed with 'iCheck-' and attached</span>
inheritID: false,
<span class="comment">// set true to activate ARIA support</span>
aria: false,
<span class="comment">// add HTML code or text inside customized input</span>
insert: ''
}
</pre>
<p>There's no need to copy and paste all of them, you can just mention the ones you need:</p>
<pre class="markup">
$('input').iCheck({
labelHover: false,
cursor: true
});
</pre>
<p>You can choose any class names and slyle them as you want.</p>
<h4 class="init">Initialize</h4>
<p>Just include <span class="mark">icheck.js</span> after <a href="http://jquery.com" target="blank">jQuery v1.7+</a> (or <a href="http://github.com/madrobby/zepto#zepto-modules" target="blank">Zepto</a> [polyfill, event, data]).</p>
<p>iCheck supports any selectors, but handles only checkboxes and radio buttons:</p>
<pre class="markup">
<span class="comment">// customize all inputs (will search for checkboxes and radio buttons)</span>
$('input').iCheck();
<span class="comment">// handle inputs only inside $('.block')</span>
$('.block input').iCheck();
<span class="comment">// handle only checkboxes inside $('.test')</span>
$('.test input').iCheck({
handle: 'checkbox'
});
<span class="comment">// handle .vote class elements (will search inside the element, if it's not an input)</span>
$('.vote').iCheck();
<span class="comment">// you can also change options after inputs are customized</span>
$('input.some').iCheck({
<span class="comment">// different options</span>
});
</pre>
<h4 class="indeterminate">Indeterminate</h4>
<p>HTML5 allows specifying <a href="http://css-tricks.com/indeterminate-checkboxes/" target="blank">indeterminate</a> ("partially" checked) state for checkboxes. iCheck supports it for both checkboxes and radio buttons.</p>
<p>You can make an input indeterminate through HTML using additional attributes (supported by iCheck). Both do the same job, but <span class="mark">indeterminate="true"</span> may not work in some browsers (like IE7):</p>
<pre class="markup">
<span class="comment"><!-- indeterminate="true" --></span>
<input type="checkbox" indeterminate="true">
<input type="radio" indeterminate="true">
<span class="comment"><!-- determinate="false" --></span>
<input type="checkbox" determinate="false">
<input type="radio" determinate="false">
</pre>
<p><span class="mark">indeterminate</span> and <span class="mark">determinate</span> <span class="self" data-to="methods">methods</span> can be used to toggle indeterminate state.</p>
<h4 class="callbacks">Callbacks</h4>
<p class="callbacks-info">iCheck provides plenty callbacks, which may be used to handle changes.</p>
<table>
<thead>
<tr>
<th>Callback name</th>
<td>When used</td>
</tr>
</thead>
<tbody>
<tr>
<th>ifClicked</th>
<td>user clicked on a customized input or an assigned label</td>
</tr>
<tr>
<th>ifChanged</th>
<td>input's <span class="mark">checked</span>, <span class="mark">disabled</span> or <span class="mark">indeterminate</span> state is changed</td>
</tr>
<tr>
<th>ifChecked</th>
<td>input's state is changed to <span class="mark">checked</span></td>
</tr>
<tr>
<th>ifUnchecked</th>
<td><span class="mark">checked</span> state is removed</td>
</tr>
<tr>
<th>ifToggled</th>
<td>input's <span class="mark">checked</span> state is changed</td>
</tr>
<tr>
<th>ifDisabled</th>
<td>input's state is changed to <span class="mark">disabled</span></td>
</tr>
<tr>
<th>ifEnabled</th>
<td><span class="mark">disabled</span> state is removed</td>
</tr>
<tr>
<th>ifIndeterminate</th>
<td>input's state is changed to <span class="mark">indeterminate</span></td>
</tr>
<tr>
<th>ifDeterminate</th>
<td><span class="mark">indeterminate</span> state is removed</td>
</tr>
<tr>
<th>ifCreated</th>
<td>input is just customized</td>
</tr>
<tr>
<th>ifDestroyed</th>
<td>customization is just removed</td>
</tr>
</tbody>
</table>
<p>Use <span class="mark">on()</span> method to bind them to inputs:<p>
<pre class="markup">
$('input').on('ifChecked', function(event){
alert(event.type + ' callback');
});
</pre>
<p><span class="mark">ifCreated</span> callback should be binded before plugin init.</p>
<h4 class="methods">Methods</h4>
<p class="methods-info">These methods can be used to make changes programmatically (any selectors can be used):</p>
<p><span class="mark">$('input').iCheck('check');</span> — change input's state to <span class="mark">checked</span></p>
<p><span class="mark">$('input').iCheck('uncheck');</span> — remove <span class="mark">checked</span> state</p>
<p><span class="mark">$('input').iCheck('toggle');</span> — toggle <span class="mark">checked</span> state</p>
<p><span class="mark">$('input').iCheck('disable');</span> — change input's state to <span class="mark">disabled</span></p>
<p><span class="mark">$('input').iCheck('enable');</span> — remove <span class="mark">disabled</span> state</p>
<p><span class="mark">$('input').iCheck('indeterminate');</span> — change input's state to <span class="mark">indeterminate</span></p>
<p><span class="mark">$('input').iCheck('determinate');</span> — remove <span class="mark">indeterminate</span> state</p>
<p><span class="mark">$('input').iCheck('update');</span> — apply input changes, which were done outside the plugin</p>
<p><span class="mark">$('input').iCheck('destroy');</span> — remove all traces of iCheck</p>
<p class="methods-callback">You may also specify some function, that will be executed on each method call:</p>
<pre class="markup">
$('input').iCheck('check', function(){
alert('Well done, Sir');
});
</pre>
<p class="issue-tracker">Feel free to <a href="http://github.com/fronteed/iCheck/">fork and submit pull-request</a> or <a href="http://github.com/fronteed/iCheck/issues">submit an issue</a> if you find something not working.</p>
</div>
</div>
<div class="benefits comparison">
<div class="arrows">
<div class="top" data-to="usage"></div>
<div class="bottom" data-to="download"></div>
</div>
<h2>Comparison</h2>
<div class="benefits-inner">
<p>iCheck is created to avoid routine of reinventing the wheel when working with checkboxes and radio buttons. It provides an expected identical result for the huge number of browsers, devices and their versions. Callbacks and methods can be used to easily handle and make changes at customized inputs.</p>
<p>There are some CSS3 ways available to style checkboxes and radio buttons, like <a href="http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/quick-tip-easy-css3-checkboxes-and-radio-buttons/" target="blank">this one</a>. You have to know about some of the disadvantages of similar methods:</p>
<ul>
<li>
— inputs are keyboard inaccessible, since <span class="mark">display: none</span> or <span class="mark">visibility: hidden</span> used to hide them
</li>
<li>
— poor browser support
</li>
<li>
— multiple bugs on mobile devices
</li>
<li>
— tricky, harder to maintain CSS code
</li>
<li>
— JavaScript is still needed to fix specific issues
</li>
</ul>
<p>While CSS3 method is quite limited solution, iCheck is made to be an everyday replacement covering most of the tasks.</p>
</div>
</div>
<div class="browsers">
<h2>Browser support</h2>
<div class="browsers-inner">
<p>iCheck is verified to work in Internet Explorer 6+, Firefox 2+, Opera 9+, Google Chrome and Safari browsers. Should also work in many others.</p>
<p>Mobile browsers (like Opera mini, Chrome mobile, Safari mobile, Android browser, Silk and others) are also supported. Tested on iOS (iPad, iPhone, iPod), Android, BlackBerry and Windows Phone devices.</p>
</div>
</div>
<div class="download">
<a href="http://github.com/fronteed/iCheck/">Download plugin</a>
</div>
<div class="license">iCheck plugin is released under the <a href="http://en.wikipedia.org/wiki/MIT_License" target="blank">MIT License</a>. Feel free to use it in personal and commercial projects.</div>
</div>
<div class="footer">
<div class="footer-inner clear">
<ul class="local">
<li>
<a href="https://github.com/fronteed/iCheck">Star on Github</a>
</li>
<li>
<a href="https://twitter.com/intent/tweet?text=Highly customizable checkboxes and radio buttons&url=http://fronteed.com/iCheck/&via=fronteed&hashtags=jQuery,Zepto">Share on Twitter</a>
</li>
<li>
<a href="http://twitter.com/fronteed/">Follow @fronteed</a>
</li>
</ul>
<div class="code">
Created by <a href="http://fronteed.com/">Damir Sultanov</a>
</div>
</div>
</div>
<a href="http://github.com/fronteed/iCheck/" class="fork-me">Fork me on GitHub</a>
</body>
</html>
|