Browse Source

Merge pull request #117 from nostalgiaz/master

update
Stein, Peter 12 years ago
parent
commit
7ab3ffb740

+ 3 - 3
README.md

@@ -4,11 +4,10 @@ Bootstrap-switch v.1.8
 You can now also use radio buttons and checkboxes as switches.
 
 
-Demos
+Demo
 ----
-http://www.larentis.eu/switch/
+Hurray! http://www.larentis.eu/switch/ moves to github pages and we are happy to tell you that we have bought a new domain: http://www.bootstrap-switch.org . Some troubles can occur so please, don't hate us :')
 
-http://bdmdesign.github.io/bootstrap-switch-BdMdesigN (uptodate)
 
 Usage
 -----
@@ -209,6 +208,7 @@ $('.mySwitch').bootstrapSwitch('toggleRadioStateAllowUncheck'); // don't allow u
 $('.mySwitch').bootstrapSwitch('toggleRadioStateAllowUncheck', false); // don't allow uncheck radio switch
 $('.mySwitch').bootstrapSwitch('toggleRadioStateAllowUncheck', true); // allow uncheck radio switch
 $('#mySwitch').bootstrapSwitch('setState', true);
+$('#mySwitch').bootstrapSwitch('setState', true || false, true); // sets the state without getting the switch-change event
 $('#mySwitch').bootstrapSwitch('setOnLabel', onValue); // sets the text of the "on" label
 $('#mySwitch').bootstrapSwitch('setOffLabel', offValue); // sets the text of the "off" label
 $('#mySwitch').bootstrapSwitch('setOnClass', onClass); // sets the left color class

File diff suppressed because it is too large
+ 385 - 369
examples/index.html


+ 14 - 14
static/js/bootstrap-switch.js

@@ -81,7 +81,7 @@
             if (icon) {
               $label.html('<i class="icon ' + icon + '"></i>');
             }
-            
+
             if (textLabel) {
               $label.html('' + textLabel + '');
             }
@@ -164,7 +164,7 @@
 
               if ($this.closest('.has-switch').is('.deactivate')) {
                 $this.unbind('click');
-              } else if ( $this.closest('.switch-on').parent().is('.radio-no-uncheck') ) {
+              } else if ($this.closest('.switch-on').parent().is('.radio-no-uncheck')) {
                 $this.unbind('click');
               } else {
                 $this.on('mousemove touchmove', function (e) {
@@ -267,7 +267,7 @@
       },
       toggleRadioState: function (skipOnChange) {
         var $radioinput = $(this).find(':radio');
-          $radioinput.not(':checked').prop('checked', !$radioinput.is(':checked')).trigger('change', skipOnChange);
+        $radioinput.not(':checked').prop('checked', !$radioinput.is(':checked')).trigger('change', skipOnChange);
       },
       toggleRadioStateAllowUncheck: function (uncheck, skipOnChange) {
         var $radioinput = $(this).find(':radio');
@@ -281,15 +281,15 @@
       setState: function (value, skipOnChange) {
         $(this).find(inputSelector).prop('checked', value).trigger('change', skipOnChange);
       },
-      setOnLabel: function(value) {
+      setOnLabel: function (value) {
         var $switchLeft = $(this).find(".switch-left");
         $switchLeft.html(value);
       },
-      setOffLabel: function(value) {
+      setOffLabel: function (value) {
         var $switchRight = $(this).find(".switch-right");
         $switchRight.html(value);
       },
-      setOnClass: function(value) {
+      setOnClass: function (value) {
         var $switchLeft = $(this).find(".switch-left");
         var color = '';
         if (value !== undefined) {
@@ -301,7 +301,7 @@
           $switchLeft.addClass(color);
         }
       },
-      setOffClass: function(value) {
+      setOffClass: function (value) {
         var $switchRight = $(this).find(".switch-right");
         var color = '';
         if (value !== undefined) {
@@ -313,7 +313,7 @@
           $switchRight.addClass(color);
         }
       },
-      setAnimated: function(value) {
+      setAnimated: function (value) {
         var $element = $(this).find(inputSelector).parent();
         if (value === undefined) value = false;
         $element.data('animated', value);
@@ -325,14 +325,14 @@
           $element.removeClass("switch-animate");
         }
       },
-      setSizeClass: function(value) {
+      setSizeClass: function (value) {
         var $element = $(this);
         var $switchLeft = $element.find(".switch-left");
         var $switchRight = $element.find(".switch-right");
         var $label = $element.find("label");
         $.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
           if (el !== value) {
-            $switchLeft.removeClass(el);
+            $switchLeft.removeClass(el)
             $switchRight.removeClass(el);
             $label.removeClass(el);
           } else {
@@ -376,8 +376,8 @@
   };
 }(jQuery);
 
-(function($) {  // creates scope for $ sign assigned to jQuery
-    $(function () { // on dom ready
-        $('.make-switch')['bootstrapSwitch'](); // attach bootstrapswitch
-    });
+(function ($) {
+  $(function () {
+    $('.make-switch')['bootstrapSwitch']();
+  });
 })(jQuery);

File diff suppressed because it is too large
+ 0 - 1
static/js/bootstrap-switch.min.js


+ 1 - 1
static/less/bootstrap-switch.less

@@ -126,7 +126,7 @@
     border-left: 1px solid @btnBorder;
     border-right: 1px solid @btnBorder;
 
-    .buttonBackground(@btnBackground, @btnBackgroundHighlight);
+    .buttonBackground(@btnBackground, @btnBackgroundHighlight, @grayDark);
 
     i {
       color: #000;

+ 4 - 5
static/stylesheets/bootstrap-switch.css

@@ -28,6 +28,7 @@
   -ms-user-select: none;
   -o-user-select: none;
   user-select: none;
+  vertical-align: middle;
   min-width: 100px;
 }
 .has-switch.switch-mini {
@@ -42,9 +43,6 @@
   margin-top: -1px;
   margin-bottom: -1px;
 }
-.has-switch.switch-mini i.switch-mini-font-icons {
-  line-height: 9px;
-}
 .has-switch.switch-small {
   min-width: 80px;
 }
@@ -121,10 +119,11 @@
   text-align: center;
   margin-top: -1px;
   margin-bottom: -1px;
+  z-index: 100;
   width: 34%;
   border-left: 1px solid #cccccc;
   border-right: 1px solid #cccccc;
-  color: #000000;
+  color: #333333;
   text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
   background-color: #f5f5f5;
   background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
@@ -147,7 +146,7 @@
 .has-switch label.active,
 .has-switch label.disabled,
 .has-switch label[disabled] {
-  color: #000000;
+  color: #333333;
   background-color: #e6e6e6;
   *background-color: #d9d9d9;
 }

Some files were not shown because too many files changed in this diff