ソースを参照

Re-styles range inputs for Chrome and FF.

j8
yanas 8年前
コミット
ebab617a12
4個のファイルの変更81行の追加3行の削除
  1. 36
    2
      css/_mixins.scss
  2. 41
    0
      css/components/_input-slider.scss
  3. 2
    1
      css/main.scss
  4. 2
    0
      css/themes/_light.scss

+ 36
- 2
css/_mixins.scss ファイルの表示

@@ -90,8 +90,8 @@
90 90
 }
91 91
 
92 92
 /**
93
-* Mixin styling placeholder
94
-**/
93
+ * Mixin styling a placeholder.
94
+ **/
95 95
 @mixin placeholder() {
96 96
   $selectors: (
97 97
           "::-webkit-input-placeholder",
@@ -107,6 +107,40 @@
107 107
   }
108 108
 }
109 109
 
110
+/**
111
+ * Mixin styling a slider track for different browsers.
112
+ **/
113
+@mixin slider() {
114
+  $selectors: (
115
+          "input[type=range]::-webkit-slider-runnable-track",
116
+          "input[type=range]::-moz-range-track",
117
+          "input[type=range]::-ms-track"
118
+  );
119
+
120
+  @each $selector in $selectors {
121
+    #{$selector} {
122
+      @content;
123
+    }
124
+  }
125
+}
126
+
127
+/**
128
+ * Mixin styling a slider thumb for different browsers.
129
+ **/
130
+@mixin slider-thumb() {
131
+  $selectors: (
132
+          "input[type=range]::-webkit-slider-thumb",
133
+          "input[type=range]::-moz-range-thumb",
134
+          "input[type=range]::-ms-thumb"
135
+  );
136
+
137
+  @each $selector in $selectors {
138
+    #{$selector} {
139
+      @content;
140
+    }
141
+  }
142
+}
143
+
110 144
 @mixin box-shadow($h, $y, $blur, $color, $inset: false) {
111 145
   @if $inset {
112 146
     -webkit-box-shadow: inset $h $y $blur $color;

+ 41
- 0
css/components/_input-slider.scss ファイルの表示

@@ -0,0 +1,41 @@
1
+/**
2
+ * Disable the default webkit styles for range inputs (sliders).
3
+ */
4
+input[type=range]{
5
+  -webkit-appearance: none;
6
+  background: none;
7
+}
8
+
9
+/**
10
+ * Disable the default focus styles for webkit range inputs (sliders).
11
+ */
12
+input[type=range]:focus {
13
+  outline: none;
14
+}
15
+
16
+/**
17
+ * Include the mixin for a range input style.
18
+ */
19
+@include slider {
20
+  background: $sliderTrackBackground;
21
+  border: none;
22
+  border-radius: 3px;
23
+  cursor: pointer;
24
+  height: 6px;
25
+  width: 100%;
26
+}
27
+
28
+/**
29
+ * Include the mixin for a range input thumb style.
30
+ */
31
+@include slider-thumb {
32
+  -webkit-appearance: none;
33
+  background: white;
34
+  border: 1px solid $sliderThumbBackground;
35
+  border-radius: 50%;
36
+  box-shadow: 0px 0px 1px $sliderThumbBackground;
37
+  cursor: pointer;
38
+  height: 14px;
39
+  margin-top: -4px;
40
+  width: 14px;
41
+}

+ 2
- 1
css/main.scss ファイルの表示

@@ -60,7 +60,8 @@
60 60
 @import 'components/link';
61 61
 @import 'shortcuts/main';
62 62
 @import 'components/button-control';
63
-@import 'components/_input-control.scss';
63
+@import 'components/input-control';
64
+@import 'components/input-slider';
64 65
 @import "modals/invite/invite";
65 66
 @import "connection-info";
66 67
 @import 'aui-components/dropdown';

+ 2
- 0
css/themes/_light.scss ファイルの表示

@@ -8,6 +8,8 @@ $baseLight: #FFFFFF;
8 8
 */
9 9
 $controlBackground: $baseLight;
10 10
 $controlColor: #333333;
11
+$sliderTrackBackground: #474747;
12
+$sliderThumbBackground: #3572b0;
11 13
 
12 14
 /**
13 15
 * Buttons

読み込み中…
キャンセル
保存