Jelajahi Sumber

Added a change event on the label click

pauloortins 11 tahun lalu
induk
melakukan
9e0430e50e

+ 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)
         });
       };

File diff ditekan karena terlalu besar
+ 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"

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini