bootstrap-switch.less 3.4 KB

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