-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharrow.less
67 lines (57 loc) · 2.57 KB
/
arrow.less
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
## CSS ARROWS
Mixin to give css arrows (with given properties) on elements. (based on http://cssarrowplease.com/)
You can give the arrow border, so this is what's different from the #popoverArrow
*/
#arrow {
#create(@size, @color, @border-width, @border-color, @position1, @value1, @position2, @value2) {
position: relative;
background: @color;
border: @border-width solid @border-color;
&:after, &:before {
.arrow-position(@position1, @value1);
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
&:after {
.arrow-border-color(@position1, @color);
border-width: @size;
.arrow-position(@position2, @value2);
.arrow-margin(@position2, 0px - @size);
}
&:before {
.arrow-border-color(@position1, @border-color);
border-width: @size + round(1.41421356 * @border-width);
.arrow-position(@position2, @value2);
.arrow-margin(@position2, 0px - (@size + round(1.41421356 * @border-width)));
}
}
.arrow-position(bottom, @value) { bottom: @value; }
.arrow-position(left, @value) { left: @value; }
.arrow-position(top, @value) { top: @value; }
.arrow-position(right, @value) { right: @value; }
.arrow-border-color(bottom, @value) { border-bottom-color: @value; }
.arrow-border-color(left, @value) { border-left-color: @value; }
.arrow-border-color(top, @value) { border-top-color: @value; }
.arrow-border-color(right, @value) { border-right-color: @value; }
.arrow-margin(bottom, @value) { margin-bottom: @value; }
.arrow-margin(left, @value) { margin-left: @value; }
.arrow-margin(top, @value) { margin-top: @value; }
.arrow-margin(right, @value) { margin-right: @value; }
.top(@size, @color, @border-width, @border-color) {
#arrow > #create(@size, @color, @border-width, @border-color, bottom, 100%, left, 50%);
}
.left(@size, @color, @border-width, @border-color) {
#arrow > #create(@size, @color, @border-width, @border-color, right, 100%, top, 50%);
}
.right(@size, @color, @border-width, @border-color) {
#arrow > #create(@size, @color, @border-width, @border-color, left, 100%, top, 50%);
}
.bottom(@size, @color, @border-width, @border-color) {
#arrow > #create(@size, @color, @border-width, @border-color, top, 100%, left, 50%);
}
}