Ver código fonte

fixed bug in some php environments

"(function () { 
  jQuery('.switch')['bootstrapSwitch'](); 
})();"

breaks in some php environments the swiches, because don't set the class "has-switch"

The following code fixes the bug:

"(function($) {  // creates scope for $ sign assigned to jQuery
    $(function () { // on dom ready
        $('.switch')['bootstrapSwitch'](); // attach bootstrapswitch
    });
})(jQuery);"

( https://github.com/nostalgiaz/bootstrap-switch/issues/75#issuecomment-20727665 )
Stein, Peter 11 anos atrás
pai
commit
e50591a646
1 arquivos alterados com 5 adições e 3 exclusões
  1. 5 3
      static/js/bootstrap-switch.js

+ 5 - 3
static/js/bootstrap-switch.js

@@ -302,6 +302,8 @@
   };
 }(jQuery);
 
-(function () {
-  jQuery('.switch')['bootstrapSwitch']();
-})();
+(function($) {  // creates scope for $ sign assigned to jQuery
+    $(function () { // on dom ready
+        $('.switch')['bootstrapSwitch'](); // attach bootstrapswitch
+    });
+})(jQuery);