bootstrap-switch.less 3.6 KB

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