bootstrap-switch.less 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. @bootstrap-switch-base: bootstrap-switch;
  2. .@{bootstrap-switch-base} {
  3. display: inline-block;
  4. cursor: pointer;
  5. border-radius: @border-radius-base;
  6. border: 1px solid;
  7. border-color: @btn-default-border;
  8. position: relative;
  9. text-align: left;
  10. overflow: hidden;
  11. line-height: 8px;
  12. .user-select(none);
  13. vertical-align: middle;
  14. min-width: 100px;
  15. .transition(~"border-color ease-in-out .15s, box-shadow ease-in-out .15s");
  16. &.@{bootstrap-switch-base}-mini {
  17. min-width: 71px;
  18. .@{bootstrap-switch-base}-handle-on,
  19. .@{bootstrap-switch-base}-handle-off,
  20. .@{bootstrap-switch-base}-label {
  21. padding-bottom: 4px;
  22. padding-top: 4px;
  23. font-size: 10px;
  24. line-height: 9px;
  25. }
  26. }
  27. &.@{bootstrap-switch-base}-small {
  28. min-width: 79px;
  29. .@{bootstrap-switch-base}-handle-on,
  30. .@{bootstrap-switch-base}-handle-off,
  31. .@{bootstrap-switch-base}-label {
  32. padding-bottom: 3px;
  33. padding-top: 3px;
  34. font-size: 12px;
  35. line-height: 18px;
  36. }
  37. }
  38. &.@{bootstrap-switch-base}-large {
  39. min-width: 120px;
  40. .@{bootstrap-switch-base}-handle-on,
  41. .@{bootstrap-switch-base}-handle-off,
  42. .@{bootstrap-switch-base}-label {
  43. padding-bottom: 9px;
  44. padding-top: 9px;
  45. font-size: 16px;
  46. line-height: normal;
  47. }
  48. }
  49. &.@{bootstrap-switch-base}-animate {
  50. .@{bootstrap-switch-base}-container {
  51. .transition(margin-left 0.5s);
  52. }
  53. }
  54. &.@{bootstrap-switch-base}-on {
  55. .@{bootstrap-switch-base}-container {
  56. margin-left: 0%;
  57. }
  58. .@{bootstrap-switch-base}-label {
  59. .border-right-radius(@border-radius-base - 1);
  60. }
  61. }
  62. &.@{bootstrap-switch-base}-off {
  63. .@{bootstrap-switch-base}-container {
  64. margin-left: -50%;
  65. }
  66. .@{bootstrap-switch-base}-label {
  67. .border-left-radius(@border-radius-base - 1);
  68. }
  69. }
  70. &.@{bootstrap-switch-base}-indeterminate {
  71. .@{bootstrap-switch-base}-container {
  72. margin-left: -25%;
  73. }
  74. }
  75. &.@{bootstrap-switch-base}-disabled,
  76. &.@{bootstrap-switch-base}-readonly,
  77. &.@{bootstrap-switch-base}-indeterminate {
  78. .opacity(.5);
  79. cursor: default !important;
  80. .@{bootstrap-switch-base}-handle-on,
  81. .@{bootstrap-switch-base}-handle-off,
  82. .@{bootstrap-switch-base}-label {
  83. cursor: default !important;
  84. }
  85. }
  86. &.@{bootstrap-switch-base}-focused {
  87. @color-rgba: rgba(red(@input-border-focus), green(@input-border-focus), blue(@input-border-focus), .6);
  88. border-color: @input-border-focus;
  89. outline: 0;
  90. .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}");
  91. }
  92. .@{bootstrap-switch-base}-container {
  93. display: inline-block;
  94. width: 150%;
  95. top: 0;
  96. border-radius: @border-radius-base;
  97. .translate3d(0, 0, 0);
  98. }
  99. .@{bootstrap-switch-base}-handle-on,
  100. .@{bootstrap-switch-base}-handle-off,
  101. .@{bootstrap-switch-base}-label {
  102. .box-sizing(border-box);
  103. cursor: pointer;
  104. display: inline-block !important;
  105. height: 100%;
  106. padding-bottom: 4px;
  107. padding-top: 4px;
  108. font-size: 14px;
  109. line-height: 20px;
  110. }
  111. .@{bootstrap-switch-base}-handle-on,
  112. .@{bootstrap-switch-base}-handle-off {
  113. text-align: center;
  114. z-index: 1;
  115. width: 33.333333333%;
  116. &.@{bootstrap-switch-base}-primary {
  117. color: #fff;
  118. background: @btn-primary-bg;
  119. }
  120. &.@{bootstrap-switch-base}-info {
  121. color: #fff;
  122. background: @btn-info-bg;
  123. }
  124. &.@{bootstrap-switch-base}-success {
  125. color: #fff;
  126. background: @btn-success-bg;
  127. }
  128. &.@{bootstrap-switch-base}-warning {
  129. background: @btn-warning-bg;
  130. color: #fff;
  131. }
  132. &.@{bootstrap-switch-base}-danger {
  133. color: #fff;
  134. background: @btn-danger-bg;
  135. }
  136. &.@{bootstrap-switch-base}-default {
  137. color: #000;
  138. background: @gray-lighter;
  139. }
  140. }
  141. .@{bootstrap-switch-base}-handle-on {
  142. .border-left-radius(@border-radius-base - 1);
  143. }
  144. .@{bootstrap-switch-base}-handle-off {
  145. .border-right-radius(@border-radius-base - 1);
  146. }
  147. .@{bootstrap-switch-base}-label {
  148. text-align: center;
  149. margin-top: -1px;
  150. margin-bottom: -1px;
  151. z-index: 100;
  152. width: 33.333333333%;
  153. color: @btn-default-color;
  154. background: @btn-default-bg;
  155. }
  156. input[type='radio'],
  157. input[type='checkbox'] {
  158. position: absolute !important;
  159. top: 0;
  160. left: 0;
  161. .opacity(0);
  162. z-index: -1;
  163. }
  164. }