Skip to content

Commit acccef0

Browse files
committed
Add title options.
1 parent 52aee2e commit acccef0

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2013 vsn4ik
3+
Copyright (c) 2014 vsn4ik
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ For some working examples of bootstrap-checkbox, visit our [examples page](http:
2727
+ <https://github.com/vsn4ik>
2828

2929
## License
30-
Copyright 2013 vsn4ik.
30+
Copyright 2014 vsn4ik.
3131

3232
Licensed under [the MIT License](LICENSE).

dist/bootstrap-checkbox.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Bootstrap-checkbox
33
* http://vsn4ik.github.io/bootstrap-checkbox
44
*
5-
* Copyright (c) 2013 vsn4ik
5+
* Copyright (c) 2014 vsn4ik
66
* Licensed under the MIT License
77
*/
88

@@ -35,6 +35,19 @@ if (typeof jQuery === 'undefined') {
3535
.insertAfter(element)
3636
.keydown(this.keydown.bind(this));
3737

38+
if (element.title) {
39+
this.$group.attr('title', element.title);
40+
}
41+
else {
42+
if (this.options.onTitle) {
43+
this.$on.attr('title', this.options.onTitle);
44+
}
45+
46+
if (this.options.offTitle) {
47+
this.$off.attr('title', this.options.offTitle);
48+
}
49+
}
50+
3851
if (!element.disabled) {
3952
this.$group.attr('tabindex', 0);
4053
}
@@ -66,7 +79,7 @@ if (typeof jQuery === 'undefined') {
6679
}
6780
},
6881
keydown: function(event) {
69-
// 13: Enter, 32: Spacebar
82+
// 13: Return, 32: Spacebar
7083
if (/^(13|32)$/.test(event.keyCode)) {
7184
// Off scroll on press "Spacebar"
7285
event.preventDefault();
@@ -83,12 +96,14 @@ if (typeof jQuery === 'undefined') {
8396
};
8497

8598
// HTML5 data-*.
86-
// <input data-on-label="43"> --> ('...').data('onLabel') === 43.
99+
// <input data-on-label="43"> --> $('input').data('onLabel') == '43'.
87100
$.fn.checkboxpicker.defaults = {
88-
onLabel: 'Yes',
89-
offLabel: 'No',
101+
defaultClass: 'btn-default',
90102
onClass: 'btn-success',
91103
offClass: 'btn-danger',
92-
defaultClass: 'btn-default'
104+
onLabel: 'Yes',
105+
offLabel: 'No',
106+
onTitle: false,
107+
offTitle: false
93108
};
94109
})(jQuery);

dist/bootstrap-checkbox.min.js

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)