_slider.scss 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. $track-color: #3ca9f1 !default;
  2. $thumb-color: $color-bot !default;
  3. $thumb-radius: 0px !default;
  4. $thumb-height: 14px !default;
  5. $thumb-width: 7px !default;
  6. $thumb-shadow-size: 1px !default;
  7. $thumb-shadow-blur: 1px !default;
  8. $thumb-shadow-color: rgba(0, 0, 0, .2) !default;
  9. $thumb-border-width: 1px !default;
  10. $thumb-border-color: $color-bot !default;
  11. $track-width: 50% !default;
  12. $track-height: 5px !default;
  13. $track-shadow-size: 1px !default;
  14. $track-shadow-blur: 1px !default;
  15. $track-shadow-color: rgba(0, 0, 0, .2) !default;
  16. $track-border-width: 1px !default;
  17. $track-border-color: $color-bot !default;
  18. $track-radius: 5px !default;
  19. $contrast: 5% !default;
  20. @mixin shadow($shadow-size, $shadow-blur, $shadow-color) {
  21. box-shadow: $shadow-size $shadow-size $shadow-blur $shadow-color, 0 0 $shadow-size lighten($shadow-color, 5%);
  22. }
  23. @mixin track {
  24. cursor: pointer;
  25. height: $track-height;
  26. transition: all .2s ease;
  27. width: $track-width;
  28. }
  29. @mixin thumb {
  30. @include shadow($thumb-shadow-size, $thumb-shadow-blur, $thumb-shadow-color);
  31. background: $thumb-color;
  32. border: $thumb-border-width solid $thumb-border-color;
  33. border-radius: $thumb-radius;
  34. cursor: pointer;
  35. height: $thumb-height;
  36. width: $thumb-width;
  37. }
  38. [type='range'] {
  39. -webkit-appearance: none;
  40. margin: $thumb-height / 2 0;
  41. width: $track-width;
  42. &:focus {
  43. outline: 0;
  44. &::-webkit-slider-runnable-track {
  45. background: lighten($track-color, $contrast);
  46. }
  47. &::-ms-fill-lower {
  48. background: $track-color;
  49. }
  50. &::-ms-fill-upper {
  51. background: lighten($track-color, $contrast);
  52. }
  53. }
  54. &::-webkit-slider-runnable-track {
  55. @include track;
  56. @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
  57. background: $track-color;
  58. border: $track-border-width solid $track-border-color;
  59. border-radius: $track-radius;
  60. }
  61. &::-webkit-slider-thumb {
  62. @include thumb;
  63. -webkit-appearance: none;
  64. margin-top: ((-$track-border-width * 2 + $track-height) / 2) - ($thumb-height / 2);
  65. }
  66. &::-moz-range-track {
  67. @include track;
  68. @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
  69. background: $track-color;
  70. border: $track-border-width solid $track-border-color;
  71. border-radius: $track-radius;
  72. }
  73. &::-moz-range-thumb {
  74. @include thumb;
  75. }
  76. &::-ms-track {
  77. @include track;
  78. background: transparent;
  79. border-color: transparent;
  80. border-width: ($thumb-height / 2) 0;
  81. color: transparent;
  82. }
  83. &::-ms-fill-lower {
  84. @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
  85. background: darken($track-color, $contrast);
  86. border: $track-border-width solid $track-border-color;
  87. border-radius: $track-radius * 2;
  88. }
  89. &::-ms-fill-upper {
  90. @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
  91. background: $track-color;
  92. border: $track-border-width solid $track-border-color;
  93. border-radius: $track-radius * 2;
  94. }
  95. &::-ms-thumb {
  96. @include thumb;
  97. margin-top: 0;
  98. }
  99. }