|
@@ -1,5 +1,5 @@
|
|
|
/* ============================================================
|
|
|
- * bootstrapSwitch v1.5 by Larentis Mattia @SpiritualGuru
|
|
|
+ * bootstrapSwitch v1.6 by Larentis Mattia @SpiritualGuru
|
|
|
* http://www.larentis.eu/
|
|
|
*
|
|
|
* Enhanced for radiobuttons by Stein, Peter @BdMdesigN
|
|
@@ -151,7 +151,9 @@
|
|
|
|
|
|
if ($this.closest('.has-switch').is('.deactivate'))
|
|
|
$this.unbind('click');
|
|
|
- else {
|
|
|
+ } else if ( $this.closest('.switch-on').parent().is('.radio-no-uncheck') ) {
|
|
|
+ $this.unbind('click');
|
|
|
+ } else {
|
|
|
$this.on('mousemove touchmove', function (e) {
|
|
|
var $element = $(this).closest('.switch')
|
|
|
, relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left
|
|
@@ -239,19 +241,29 @@
|
|
|
|
|
|
if (active) {
|
|
|
$this.removeClass('deactivate');
|
|
|
- $this.find('input').prop('disabled', false);
|
|
|
+ $this.find('input').removeAttr('disabled');
|
|
|
}
|
|
|
else {
|
|
|
$this.addClass('deactivate');
|
|
|
- $this.find('input').prop('disabled', true);
|
|
|
+ $this.find('input').attr('disabled', 'disabled');
|
|
|
}
|
|
|
},
|
|
|
toggleState: function (skipOnChange) {
|
|
|
- var $input = $(this).find('input[type=checkbox]');
|
|
|
+ var $input = $(this).find(':checkbox');
|
|
|
$input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange);
|
|
|
},
|
|
|
toggleRadioState: function (skipOnChange) {
|
|
|
- $(this).find('input[type=radio]').not(':checked').trigger('change', skipOnChange);
|
|
|
+ var $radioinput = $(this).find(':radio');
|
|
|
+ $radioinput.not(':checked').prop('checked', !$radioinput.is(':checked')).trigger('change', skipOnChange);
|
|
|
+ },
|
|
|
+ toggleRadioStateAllowUncheck: function (uncheck, skipOnChange) {
|
|
|
+ var $radioinput = $(this).find(':radio');
|
|
|
+ if (uncheck) {
|
|
|
+ $radioinput.not(':checked').trigger('change', skipOnChange);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $radioinput.not(':checked').prop('checked', !$radioinput.is(':checked')).trigger('change', skipOnChange);
|
|
|
+ }
|
|
|
},
|
|
|
setState: function (value, skipOnChange) {
|
|
|
$(this).find('input').prop('checked', value).trigger('change', skipOnChange);
|