bootstrap-switch.less 3.6 KB

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