فهرست منبع

now the switches are working also without javascript

Mattia Larentis 12 سال پیش
والد
کامیت
1b9f4fa3a7
3فایلهای تغییر یافته به همراه28 افزوده شده و 26 حذف شده
  1. 2 0
      static/js/bootstrapSwitch.js
  2. 1 1
      static/sass/bootstrapSwitch.scss
  3. 25 25
      static/stylesheets/bootstrapSwitch.css

+ 2 - 0
static/js/bootstrapSwitch.js

@@ -30,6 +30,8 @@
                 myClasses = el;
             });
 
+            $element.addClass('has-switch');
+
             if ($element.data('on') !== undefined)
               color = "switch-" + $element.data('on');
 

+ 1 - 1
static/sass/bootstrapSwitch.scss

@@ -15,7 +15,7 @@ $blue: #0088cc;
 $gray: #e6e6e6;
 $border-radius: 4px;
 
-.switch {
+.has-switch {
   display: inline-block;
   cursor: pointer;
   @include border-radius(5px);

+ 25 - 25
static/stylesheets/bootstrapSwitch.css

@@ -1,12 +1,12 @@
 /* ============================================================
- * bootstrapSwitch v1.1 by Larentis Mattia @spiritualGuru
+ * bootstrapSwitch v1.2 by Larentis Mattia @spiritualGuru
  * http://www.larentis.eu/switch/
  * ============================================================
  * Licensed under the Apache License, Version 2.0
  * http://www.apache.org/licenses/LICENSE-2.0
  * ============================================================ */
 /* line 18, ../sass/bootstrapSwitch.scss */
-.switch {
+.has-switch {
   display: inline-block;
   cursor: pointer;
   -webkit-border-radius: 5px;
@@ -30,55 +30,55 @@
   min-width: 102px;
 }
 /* line 40, ../sass/bootstrapSwitch.scss */
-.switch.switch-mini {
+.has-switch.switch-mini {
   min-width: 72px;
 }
 /* line 44, ../sass/bootstrapSwitch.scss */
-.switch.switch-small {
+.has-switch.switch-small {
   min-width: 81px;
 }
 /* line 48, ../sass/bootstrapSwitch.scss */
-.switch.switch-large {
+.has-switch.switch-large {
   min-width: 120px;
 }
 /* line 52, ../sass/bootstrapSwitch.scss */
-.switch.deactivate {
+.has-switch.deactivate {
   filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
   opacity: 0.5;
   cursor: default !important;
 }
 /* line 55, ../sass/bootstrapSwitch.scss */
-.switch.deactivate label, .switch.deactivate span {
+.has-switch.deactivate label, .has-switch.deactivate span {
   cursor: default !important;
 }
 /* line 59, ../sass/bootstrapSwitch.scss */
-.switch > div {
+.has-switch > div {
   display: inline-block;
   width: 150%;
   position: relative;
   top: 0;
 }
 /* line 65, ../sass/bootstrapSwitch.scss */
-.switch > div.switch-animate {
+.has-switch > div.switch-animate {
   -webkit-transition: left 0.5s;
   -moz-transition: left 0.5s;
   -o-transition: left 0.5s;
   transition: left 0.5s;
 }
 /* line 68, ../sass/bootstrapSwitch.scss */
-.switch > div.switch-off {
+.has-switch > div.switch-off {
   left: -50%;
 }
 /* line 71, ../sass/bootstrapSwitch.scss */
-.switch > div.switch-on {
+.has-switch > div.switch-on {
   left: 0%;
 }
 /* line 75, ../sass/bootstrapSwitch.scss */
-.switch input[type=checkbox] {
+.has-switch input[type=checkbox] {
   display: none;
 }
 /* line 83, ../sass/bootstrapSwitch.scss */
-.switch span, .switch label {
+.has-switch span, .has-switch label {
   -webkit-box-sizing: border-box;
   -moz-box-sizing: border-box;
   box-sizing: border-box;
@@ -92,28 +92,28 @@
   line-height: 20px;
 }
 /* line 96, ../sass/bootstrapSwitch.scss */
-.switch span.switch-mini, .switch label.switch-mini {
+.has-switch span.switch-mini, .has-switch label.switch-mini {
   padding-bottom: 4px;
   padding-top: 4px;
   font-size: 10px;
   line-height: 9px;
 }
 /* line 103, ../sass/bootstrapSwitch.scss */
-.switch span.switch-small, .switch label.switch-small {
+.has-switch span.switch-small, .has-switch label.switch-small {
   padding-bottom: 3px;
   padding-top: 3px;
   font-size: 12px;
   line-height: 18px;
 }
 /* line 110, ../sass/bootstrapSwitch.scss */
-.switch span.switch-large, .switch label.switch-large {
+.has-switch span.switch-large, .has-switch label.switch-large {
   padding-bottom: 9px;
   padding-top: 9px;
   font-size: 16px;
   line-height: normal;
 }
 /* line 118, ../sass/bootstrapSwitch.scss */
-.switch label {
+.has-switch label {
   background: white;
   margin-top: -1px;
   margin-bottom: -1px;
@@ -128,14 +128,14 @@
   background-image: linear-gradient(top, #ffffff, #e6e6e6);
 }
 /* line 130, ../sass/bootstrapSwitch.scss */
-.switch span {
+.has-switch span {
   color: white;
   text-align: center;
   z-index: 1;
   width: 33.333333%;
 }
 /* line 136, ../sass/bootstrapSwitch.scss */
-.switch span.switch-left {
+.has-switch span.switch-left {
   -moz-border-radius-topleft: 4px;
   -webkit-border-top-left-radius: 4px;
   border-top-left-radius: 4px;
@@ -144,7 +144,7 @@
   border-bottom-left-radius: 4px;
 }
 /* line 140, ../sass/bootstrapSwitch.scss */
-.switch span.switch-right {
+.has-switch span.switch-right {
   color: black;
   -moz-border-radius-topright: 4px;
   -webkit-border-top-right-radius: 4px;
@@ -159,7 +159,7 @@
   background-image: linear-gradient(bottom, #ffffff, #e6e6e6);
 }
 /* line 147, ../sass/bootstrapSwitch.scss */
-.switch span.switch-primary, .switch span.switch-left {
+.has-switch span.switch-primary, .has-switch span.switch-left {
   color: white;
   background: #0088cc;
   background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #0088cc), color-stop(100%, #0055cc));
@@ -169,7 +169,7 @@
   background-image: linear-gradient(bottom, #0088cc, #0055cc);
 }
 /* line 152, ../sass/bootstrapSwitch.scss */
-.switch span.switch-info {
+.has-switch span.switch-info {
   color: white;
   background: #5bc0de;
   background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #5bc0de), color-stop(100%, #2f96b4));
@@ -179,7 +179,7 @@
   background-image: linear-gradient(bottom, #5bc0de, #2f96b4);
 }
 /* line 158, ../sass/bootstrapSwitch.scss */
-.switch span.switch-success {
+.has-switch span.switch-success {
   color: white;
   background: #62c462;
   background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #62c462), color-stop(100%, #51a351));
@@ -189,7 +189,7 @@
   background-image: linear-gradient(bottom, #62c462, #51a351);
 }
 /* line 164, ../sass/bootstrapSwitch.scss */
-.switch span.switch-warning {
+.has-switch span.switch-warning {
   color: white;
   background: #dbb450;
   background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #dbb450), color-stop(100%, #f89406));
@@ -199,7 +199,7 @@
   background-image: linear-gradient(bottom, #dbb450, #f89406);
 }
 /* line 170, ../sass/bootstrapSwitch.scss */
-.switch span.switch-danger {
+.has-switch span.switch-danger {
   color: white;
   background: #ee5f5b;
   background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #ee5f5b), color-stop(100%, #bd362f));