Skip to content

Commit d36f932

Browse files
committed
Revert "Add cursor style on disabled."
This reverts commit 42ba0f1.
1 parent 42ba0f1 commit d36f932

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# [Bootstrap-checkbox](http://vsn4ik.github.io/bootstrap-checkbox)
2-
32
[![Bower version](https://badge.fury.io/bo/bootstrap-checkbox.svg)](http://badge.fury.io/bo/bootstrap-checkbox)
43

54
## Getting Started

dist/bootstrap-checkbox.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ if (typeof jQuery === 'undefined') {
1515
(function($) {
1616
var Checkboxpicker = function(element, options) {
1717
this.element = element;
18-
19-
// Change .prop('hidden', true) -> .hide() in future
20-
this.$element = $(element).prop('hidden', true);
18+
this.$element = $(element).hide();
2119

2220
this.options = $.extend({}, $.fn.checkboxpicker.defaults, options, this.$element.data());
2321

@@ -65,19 +63,20 @@ if (typeof jQuery === 'undefined') {
6563

6664
if (this.element.disabled) {
6765
this.$buttons.addClass('disabled');
68-
this.$group.css('cursor', 'not-allowed');
6966
}
7067
else {
71-
this.$element.change(this.render.bind(this));
68+
this.$element.change(this.toggle.bind(this));
7269

73-
this.$group.attr('tabindex', 0);
70+
this.$group.attr('tabindex', this.element.tabIndex);
7471

7572
if (this.element.autofocus) {
7673
this.$group.focus();
7774
}
75+
76+
$(this.element.form).on('reset', this.reset.bind(this));
7877
}
7978
},
80-
render: function() {
79+
toggle: function() {
8180
this.$group.not(':focus').focus();
8281
this.$buttons.toggleClass('active ' + this.options.defaultClass);
8382
this.$off.toggleClass(this.options.offClass);
@@ -99,12 +98,24 @@ if (typeof jQuery === 'undefined') {
9998

10099
this.change();
101100
}
101+
},
102+
reset: function() {
103+
if ((this.element.defaultChecked && this.$off.hasClass('active')) || (!this.element.defaultChecked && this.$on.hasClass('active'))) {
104+
this.toggle();
105+
}
102106
}
103107
};
104108

105109
$.fn.checkboxpicker = function(options) {
106110
return this.each(function() {
107-
new Checkboxpicker(this, options);
111+
var $this = $(this);
112+
var data = $this.data('checkboxpicker');
113+
114+
if (!data) {
115+
new Checkboxpicker(this, options);
116+
117+
$this.data('checkboxpicker', true);
118+
}
108119
});
109120
};
110121

dist/bootstrap-checkbox.min.js

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

0 commit comments

Comments
 (0)