1 | /*
|
2 | * MIT License
|
3 | *
|
4 | * Copyright (c) 2016 Microsoft
|
5 | *
|
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | * of this software and associated documentation files (the "Software"), to deal
|
8 | * in the Software without restriction, including without limitation the rights
|
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | * copies of the Software, and to permit persons to whom the Software is
|
11 | * furnished to do so, subject to the following conditions:
|
12 | *
|
13 | * The above copyright notice and this permission notice shall be included in all
|
14 | * copies or substantial portions of the Software.
|
15 | *
|
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22 | * SOFTWARE.
|
23 | */
|
24 |
|
25 | @import "./variables";
|
26 |
|
27 | /// Mixin to customize scrollbars
|
28 | /// Beware, this does not work in all browsers
|
29 | /// @author Hugo Giraudel
|
30 | /// @param {Length} $size - Horizontal scrollbar's height and vertical scrollbar's width
|
31 | /// @param {Color} $thumb-color - Scrollbar's color
|
32 | /// @param {Color} $track-color [mix($thumb-color, white, 50%)] - Scrollbar's color
|
33 | /// @example scss - Scrollbar styling
|
34 | /// @include scrollbars(.5em, slategray);
|
35 | @mixin scrollbars($size, $thumb-color, $track-color: mix($thumb-color, white, 50%), $hover-only:false) {
|
36 |
|
37 | // For Google Chrome
|
38 | &::-webkit-scrollbar {
|
39 | width: $size;
|
40 | height: $size;
|
41 | background-color: transparent;
|
42 | }
|
43 |
|
44 | &::-webkit-scrollbar-thumb {
|
45 | @if $hover-only == false {
|
46 | background: $thumb-color;
|
47 | } @else {
|
48 | background: transparent;
|
49 | }
|
50 | }
|
51 |
|
52 | &::-webkit-scrollbar-track {
|
53 | @if $hover-only == false {
|
54 | background: $track-color;
|
55 | } @else {
|
56 | background: transparent;
|
57 | }
|
58 | }
|
59 |
|
60 | @if $hover-only == true {
|
61 | &:hover::-webkit-scrollbar-thumb {
|
62 | background: $thumb-color;
|
63 | }
|
64 |
|
65 | &:hover::-webkit-scrollbar-track {
|
66 | background: $track-color;
|
67 | }
|
68 | }
|
69 |
|
70 | &::-webkit-scrollbar-track-piece {
|
71 | background: 0 0;
|
72 | }
|
73 |
|
74 | & {
|
75 | -ms-overflow-style: -ms-autohiding-scrollbar;
|
76 | -ms-scrollbar-track-color: $track-color;
|
77 | -ms-scrollbar-arrow-color: $thumb-color;
|
78 | -ms-scrollbar-face-color: $thumb-color;
|
79 | }
|
80 |
|
81 | // For Internet Explorer
|
82 | body {
|
83 | scrollbar-face-color: $thumb-color;
|
84 | scrollbar-track-color: $track-color;
|
85 | }
|
86 | } |
\ | No newline at end of file |