forked from tiaanduplessis/wenk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwenk.scss
117 lines (111 loc) · 2.95 KB
/
wenk.scss
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
$wenk-font-size: 13px !default;
$wenk-font-color: #fff !default;
$wenk-bg-color: rgba(17, 17, 17, .8) !default;
$wenk-length-small: 80px !default;
$wenk-length-medium: 150px !default;
$wenk-length-large: 260px !default;
[data-wenk] {
position: relative;
&:after {
position: absolute;
font-size: $wenk-font-size;
border-radius: .4rem;
content: attr(data-wenk);
padding: .8rem;
background-color: $wenk-bg-color;
box-shadow: 0 0 14px rgba(0, 0, 0, 0.1);
color: $wenk-font-color;
line-height: 1.25rem;
text-align: left;
z-index: 1;
pointer-events: none;
display: block;
opacity: 0;
visibility: hidden;
transition: all .3s;
bottom: 100%;
left: 50%;
transform: translate(-50%, 10px);
white-space: pre;
width: auto;
}
&:after {
opacity: 0;
}
&:hover {
overflow: visible;
&:after {
display: block;
opacity: 1;
visibility: visible;
transform: translate(-50%, -10px);
}
}
/* ===[Tooltip Down]=== */
&.wenk--bottom, &[data-wenk-pos="bottom"] {
&:after {
bottom: auto;
top: 100%;
left: 50%;
transform: translate(-50%, -10px);
}
&:hover {
&:after {
transform: translate(-50%, 10px);
}
}
}
/* ===[Tooltip Left]=== */
&.wenk--left, &[data-wenk-pos="left"] {
&:after {
bottom: auto;
left: auto;
top: 50%;
right: 100%;
transform: translate(10px, -50%);
}
&:hover {
&:after {
transform: translate(-10px, -50%);
}
}
}
/* ===[Tooltip Right]=== */
&.wenk--right, &[data-wenk-pos="right"] {
&:after {
bottom: auto;
top: 50%;
left: 100%;
transform: translate(-10px, -50%);
}
&:hover {
&:after {
transform: translate(10px, -50%);
}
}
}
/* ===[Length of tooltip]=== */
&[data-wenk-length="small"]:after, &.wenk-length--small:after {
white-space: normal;
width: $wenk-length-small;
}
&[data-wenk-length="medium"]:after, &.wenk-length--medium:after {
white-space: normal;
width: $wenk-length-medium;
}
&[data-wenk-length="large"]:after, &.wenk-length--large:after {
white-space: normal;
width: $wenk-length-large;
}
&[data-wenk-length="fit"]:after, &.wenk-length--fit:after {
white-space: normal;
width: 100%;
}
/* ===[Alignment of tooltip]=== */
&[data-wenk-align="right"]:after, &.wenk-align--right:after {
text-align: right;
}
&[data-wenk-align="center"]:after, &.wenk-align--center:after {
text-align: center;
}
}