浏览代码

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 年之前
父节点
当前提交
e50591a646
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      static/js/bootstrap-switch.js

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

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