bootstrap-switch.less 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /* ============================================================
  2. * bootstrap-switch v1.9.0 by Larentis Mattia @SpiritualGuru
  3. * http://www.larentis.eu/
  4. *
  5. * Enhanced for radiobuttons by Stein, Peter @BdMdesigN
  6. * http://www.bdmdesign.org/
  7. *
  8. * Project site:
  9. * http://www.bootstrap-switch.org
  10. * ============================================================
  11. * Licensed under the Apache License, Version 2.0
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. * ============================================================ */
  14. @import "variables";
  15. @import "mixins";
  16. .has-switch {
  17. display: inline-block;
  18. cursor: pointer;
  19. .border-radius(5px);
  20. border: 1px solid;
  21. border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  22. position: relative;
  23. text-align: left;
  24. overflow: hidden;
  25. line-height: 8px;
  26. .user-select(none);
  27. vertical-align: middle;
  28. min-width: 100px;
  29. &.switch-mini {
  30. min-width: 72px;
  31. i.switch-mini-icons {
  32. height: 1.20em;
  33. line-height: 9px;
  34. vertical-align: text-top;
  35. text-align: center;
  36. transform: scale(0.6);
  37. margin-top: -1px;
  38. margin-bottom: -1px;
  39. }
  40. }
  41. &.switch-small {
  42. min-width: 80px;
  43. }
  44. &.switch-large {
  45. min-width: 120px;
  46. }
  47. &.deactivate {
  48. .opacity(50);
  49. cursor: default !important;
  50. label,
  51. span {
  52. cursor: default !important;
  53. }
  54. }
  55. > div {
  56. display: inline-block;
  57. width: 150%;
  58. position: relative;
  59. top: 0;
  60. &.switch-animate {
  61. .transition(left 0.5s);
  62. }
  63. &.switch-off {
  64. left: -50%;
  65. }
  66. &.switch-on {
  67. left: 0%;
  68. }
  69. }
  70. input[type=radio],
  71. input[type=checkbox] {
  72. // debug
  73. display: none;
  74. // position: absolute;
  75. // margin-left: 60%;
  76. // z-index: 123;
  77. }
  78. span,
  79. label {
  80. .box-sizing(border-box);
  81. cursor: pointer;
  82. position: relative;
  83. display: inline-block;
  84. height: 100%;
  85. padding-bottom: 4px;
  86. padding-top: 4px;
  87. font-size: 14px;
  88. line-height: 20px;
  89. &.switch-mini {
  90. padding-bottom: 4px;
  91. padding-top: 4px;
  92. font-size: 10px;
  93. line-height: 9px;
  94. }
  95. &.switch-small {
  96. padding-bottom: 3px;
  97. padding-top: 3px;
  98. font-size: 12px;
  99. line-height: 18px;
  100. }
  101. &.switch-large {
  102. padding-bottom: 9px;
  103. padding-top: 9px;
  104. font-size: 16px;
  105. line-height: normal;
  106. }
  107. }
  108. label {
  109. text-align: center;
  110. margin-top: -1px;
  111. margin-bottom: -1px;
  112. z-index: 100;
  113. width: 34%;
  114. border-left: 1px solid @btnBorder;
  115. border-right: 1px solid @btnBorder;
  116. .buttonBackground(@btnBackground, @btnBackgroundHighlight, @grayDark);
  117. i {
  118. color: #000;
  119. text-shadow: 0 1px 0 #fff;
  120. line-height: 18px;
  121. pointer-events: none;
  122. }
  123. }
  124. span {
  125. text-align: center;
  126. z-index: 1;
  127. width: 33%;
  128. &.switch-left {
  129. .border-left-radius(4px);
  130. }
  131. &.switch-right {
  132. .buttonBackground(@btnBackgroundHighlight, @btnBackground, @grayDark, 0 1px 1px rgba(255,255,255,.75));
  133. }
  134. &.switch-primary, &.switch-left {
  135. .buttonBackground(@btnPrimaryBackgroundHighlight, @btnPrimaryBackground);
  136. }
  137. &.switch-info {
  138. .buttonBackground(@btnInfoBackgroundHighlight, @btnInfoBackground);
  139. }
  140. &.switch-success {
  141. .buttonBackground(@btnSuccessBackgroundHighlight, @btnSuccessBackground);
  142. }
  143. &.switch-warning {
  144. .buttonBackground(@btnWarningBackgroundHighlight, @btnWarningBackground);
  145. }
  146. &.switch-danger {
  147. .buttonBackground(@btnDangerBackgroundHighlight, @btnDangerBackground);
  148. }
  149. &.switch-default {
  150. .buttonBackground(@btnBackgroundHighlight, @btnBackground, @grayDark, 0 1px 1px rgba(255,255,255,.75));
  151. }
  152. }
  153. }