瀏覽代碼

Made it impossible to uncheck a checked radio button.

George K 11 年之前
父節點
當前提交
132ac97afe
共有 3 個文件被更改,包括 4 次插入0 次删除
  1. 3 0
      dist/js/bootstrap-switch.js
  2. 0 0
      dist/js/bootstrap-switch.min.js
  3. 1 0
      src/coffee/bootstrap-switch.coffee

+ 3 - 0
dist/js/bootstrap-switch.js

@@ -121,6 +121,9 @@
         if (this.options.disabled || this.options.readonly || this.options.indeterminate) {
           return this.$element;
         }
+        if (this.options.state && this.$element.is(':radio')) {
+          return this.$element;
+        }
         value = !!value;
         this.$element.prop("checked", value).trigger("change.bootstrapSwitch", skip);
         return this.$element;

文件差異過大導致無法顯示
+ 0 - 0
dist/js/bootstrap-switch.min.js


+ 1 - 0
src/coffee/bootstrap-switch.coffee

@@ -74,6 +74,7 @@ do ($ = window.jQuery, window) ->
     state: (value, skip) ->
       return @options.state if typeof value is "undefined"
       return @$element if @options.disabled or @options.readonly or @options.indeterminate
+      return @$element if @options.state and @$element.is ':radio'
 
       value = not not value
 

部分文件因文件數量過多而無法顯示