浏览代码

Added a change event on the label click

pauloortins 11 年之前
父节点
当前提交
9e0430e50e
共有 3 个文件被更改,包括 10 次插入0 次删除
  1. 6 0
      dist/js/bootstrap-switch.js
  2. 0 0
      dist/js/bootstrap-switch.min.js
  3. 4 0
      src/coffee/bootstrap-switch.coffee

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

@@ -427,6 +427,12 @@
             return function(e) {
               return _this.$label.trigger("mouseup.bootstrapSwitch");
             };
+          })(this),
+          "click.bootstrapSwitch": (function(_this) {
+            return function(e) {
+              _this.toggleState();
+              return _this.$element.trigger('focus.bootstrapSwitch');
+            };
           })(this)
         });
       };

文件差异内容过多而无法显示
+ 0 - 0
dist/js/bootstrap-switch.min.js


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

@@ -324,6 +324,10 @@ do ($ = window.jQuery, window) ->
 
         "mouseleave.bootstrapSwitch": (e) =>
           @$label.trigger "mouseup.bootstrapSwitch"
+        
+        "click.bootstrapSwitch": (e) =>
+          @toggleState()
+          @$element.trigger 'focus.bootstrapSwitch'
 
     _formHandler: ->
       $form = @$element.closest "form"

部分文件因为文件数量过多而无法显示