_range.scss 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* Range
  2. ========================================================================== */
  3. .range-field {
  4. position: relative;
  5. }
  6. input[type=range],
  7. input[type=range] + .thumb {
  8. @extend .no-select;
  9. cursor: pointer;
  10. }
  11. input[type=range] {
  12. position: relative;
  13. background-color: transparent;
  14. border: none;
  15. outline: none;
  16. width: 100%;
  17. margin: 15px 0;
  18. padding: 0;
  19. &:focus {
  20. outline: none;
  21. }
  22. }
  23. input[type=range] + .thumb {
  24. position: absolute;
  25. top: 10px;
  26. left: 0;
  27. border: none;
  28. height: 0;
  29. width: 0;
  30. border-radius: 50%;
  31. background-color: $radio-fill-color;
  32. margin-left: 7px;
  33. transform-origin: 50% 50%;
  34. transform: rotate(-45deg);
  35. .value {
  36. display: block;
  37. width: 30px;
  38. text-align: center;
  39. color: $radio-fill-color;
  40. font-size: 0;
  41. transform: rotate(45deg);
  42. }
  43. &.active {
  44. border-radius: 50% 50% 50% 0;
  45. .value {
  46. color: $input-background;
  47. margin-left: -1px;
  48. margin-top: 8px;
  49. font-size: 10px;
  50. }
  51. }
  52. }
  53. // Shared
  54. @mixin range-track {
  55. height: $track-height;
  56. background: #c2c0c2;
  57. border: none;
  58. }
  59. @mixin range-thumb {
  60. border: none;
  61. height: $range-height;
  62. width: $range-width;
  63. border-radius: 50%;
  64. background: $radio-fill-color;
  65. transition: box-shadow .3s;
  66. }
  67. // WebKit
  68. input[type=range] {
  69. -webkit-appearance: none;
  70. }
  71. input[type=range]::-webkit-slider-runnable-track {
  72. @include range-track;
  73. }
  74. input[type=range]::-webkit-slider-thumb {
  75. @include range-thumb;
  76. -webkit-appearance: none;
  77. background-color: $radio-fill-color;
  78. transform-origin: 50% 50%;
  79. margin: -5px 0 0 0;
  80. }
  81. .keyboard-focused input[type=range]:focus:not(.active)::-webkit-slider-thumb {
  82. box-shadow: 0 0 0 10px rgba($radio-fill-color, .26);
  83. }
  84. // FireFox
  85. input[type=range] {
  86. /* fix for FF unable to apply focus style bug */
  87. border: 1px solid white;
  88. /*required for proper track sizing in FF*/
  89. }
  90. input[type=range]::-moz-range-track {
  91. @include range-track;
  92. }
  93. input[type=range]::-moz-focus-inner {
  94. border: 0;
  95. }
  96. input[type=range]::-moz-range-thumb {
  97. @include range-thumb;
  98. margin-top: -5px;
  99. }
  100. // hide the outline behind the border
  101. input[type=range]:-moz-focusring {
  102. outline: 1px solid #fff;
  103. outline-offset: -1px;
  104. }
  105. .keyboard-focused input[type=range]:focus:not(.active)::-moz-range-thumb {
  106. box-shadow: 0 0 0 10px rgba($radio-fill-color, .26);
  107. }
  108. // IE 10+
  109. input[type=range]::-ms-track {
  110. height: $track-height;
  111. // remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead
  112. background: transparent;
  113. // leave room for the larger thumb to overflow with a transparent border */
  114. border-color: transparent;
  115. border-width: 6px 0;
  116. /*remove default tick marks*/
  117. color: transparent;
  118. }
  119. input[type=range]::-ms-fill-lower {
  120. background: #777;
  121. }
  122. input[type=range]::-ms-fill-upper {
  123. background: #ddd;
  124. }
  125. input[type=range]::-ms-thumb {
  126. @include range-thumb;
  127. }
  128. .keyboard-focused input[type=range]:focus:not(.active)::-ms-thumb {
  129. box-shadow: 0 0 0 10px rgba($radio-fill-color, .26);
  130. }