浏览代码

switch state as init event second parameter

Emanuele Marchi 10 年之前
父节点
当前提交
c23201900e

+ 1 - 1
dist/js/bootstrap-switch.js

@@ -115,7 +115,7 @@
         this._labelHandlers();
         this._formHandler();
         this._externalLabelHandler();
-        this.$element.trigger("init.bootstrapSwitch");
+        this.$element.trigger("init.bootstrapSwitch", this.options.state);
       }
 
       BootstrapSwitch.prototype._constructor = BootstrapSwitch;

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


+ 4 - 1
events.html

@@ -79,7 +79,10 @@
             <tr>
               <td>init</td>
               <td>Triggered on initialization. 'this' refers to the DOM element.</td>
-              <td>event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>)</td>
+              <td>
+                event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>)
+                state (true | false)
+              </td>
             </tr>
             <tr>
               <td>switchChange</td>

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

@@ -74,7 +74,7 @@ do ($ = window.jQuery, window) ->
       @_formHandler()
       @_externalLabelHandler()
 
-      @$element.trigger "init.bootstrapSwitch"
+      @$element.trigger "init.bootstrapSwitch", @options.state
 
     _constructor: BootstrapSwitch
 

+ 1 - 0
src/docs/jade/events.jade

@@ -30,6 +30,7 @@ block content
           td Triggered on initialization. 'this' refers to the DOM element.
           td
             | event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>)
+            | state (true | false)
         tr
           td switchChange
           td Triggered on switch state change. 'this' refers to the DOM element.

+ 1 - 1
test/bootstrap-switch.js

@@ -115,7 +115,7 @@
         this._labelHandlers();
         this._formHandler();
         this._externalLabelHandler();
-        this.$element.trigger("init.bootstrapSwitch");
+        this.$element.trigger("init.bootstrapSwitch", this.options.state);
       }
 
       BootstrapSwitch.prototype._constructor = BootstrapSwitch;

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