]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * adds a css outline to an element with compatibility for IE8/outline-offset\r | |
3 | * NOTE: the element receiving the outline must be positioned (either relative or absolute)\r | |
4 | * in order for the outline to work in IE8\r | |
5 | *\r | |
6 | * @param {number} [$width=1px]\r | |
7 | * The width of the outline\r | |
8 | *\r | |
9 | * @param {string} [$style=solid]\r | |
10 | * The style of the outline\r | |
11 | *\r | |
12 | * @param {color} [$color=#000]\r | |
13 | * The color of the outline\r | |
14 | *\r | |
15 | * @param {number} [$offset=0]\r | |
16 | * The offset of the outline\r | |
17 | *\r | |
18 | * @param {number/list} [$border-width=0]\r | |
19 | * The border-width of the element receiving the outline.\r | |
20 | * Required in order for outline-offset to work in IE8\r | |
21 | *\r | |
22 | * @param {boolean} [$pseudo=false]\r | |
23 | * `true to always use a pseudo element to render the outline.\r | |
24 | * by default this behavior is limited to IE8 only, but can be enabled in all browser\r | |
25 | * when required\r | |
26 | * \r | |
27 | * @member Global_CSS\r | |
28 | * @private\r | |
29 | */\r | |
30 | @mixin css-outline(\r | |
31 | $width: 1px,\r | |
32 | $style: solid,\r | |
33 | $color: #000,\r | |
34 | $offset: 0,\r | |
35 | $border-width: 0,\r | |
36 | $pseudo: false\r | |
37 | ) {\r | |
38 | @mixin css-outline-pseudo() {\r | |
39 | &:after {\r | |
40 | position: absolute;\r | |
41 | content: ' ';\r | |
42 | top: -$offset - $width - top($border-width) ;\r | |
43 | right: -$offset - $width - right($border-width);\r | |
44 | bottom: -$offset - $width - bottom($border-width);\r | |
45 | left: -$offset - $width - left($border-width);\r | |
46 | \r | |
47 | border: $width $style $color;\r | |
48 | pointer-events: none;\r | |
49 | }\r | |
50 | }\r | |
51 | \r | |
52 | @if $pseudo {\r | |
53 | @include css-outline-pseudo;\r | |
54 | } @else {\r | |
55 | outline: $width $style $color;\r | |
56 | outline-offset: $offset;\r | |
57 | \r | |
58 | @if $include-ie {\r | |
59 | .#{$prefix}ie8 & {\r | |
60 | outline: none;\r | |
61 | @include css-outline-pseudo;\r | |
62 | \r | |
63 | }\r | |
64 | }\r | |
65 | }\r | |
66 | } |