Skip to content

Commit 3fea6bc

Browse files
authored
Merge pull request #3 from TheCodeRaccoons/Update]-Tooltip-refactory
[Update] Refactoring tooltip script
2 parents 001a2af + 955d82b commit 3fea6bc

2 files changed

Lines changed: 104 additions & 0 deletions

File tree

Dist/Functional/Tooltip.css

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
[wt-tooltip-content]:not([wt-tooltip-content=""]) {
2+
position: relative;
3+
}
4+
5+
[wt-tooltip-content]:not([wt-tooltip-content=""])::after {
6+
content: attr(wt-tooltip-content);
7+
position: absolute;
8+
box-sizing: border-box;
9+
left: 50%;
10+
bottom: 100%;
11+
transform: translateX(-50%) scale(0);
12+
transform-origin: bottom center;
13+
z-index: 1070;
14+
margin: 0 0 10px;
15+
padding: 8px 11px;
16+
font-size: 14px;
17+
line-height: 1em;
18+
color: white;
19+
text-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5);
20+
white-space: nowrap;
21+
pointer-events: none;
22+
background-color: rgba(64, 64, 64, 0.75);
23+
border-radius: 3px;
24+
opacity: 0;
25+
transition: all 0.08s ease;
26+
}
27+
28+
[wt-tooltip-content]:not([wt-tooltip-content=""]):hover::after {
29+
transform: translateX(-50%) scale(1);
30+
opacity: 1;
31+
}
32+
33+
[wt-tooltip-content]:not([wt-tooltip-content=""])::before {
34+
content: "";
35+
box-sizing: border-box;
36+
width: 14px;
37+
height: 7px;
38+
position: absolute;
39+
top: -10px;
40+
left: 50%;
41+
transform: scale(0);
42+
transform-origin: top center;
43+
z-index: 1070;
44+
margin-left: -7px;
45+
border-top: 7px solid rgba(64, 64, 64, 0.75);
46+
border-left: 7px solid transparent;
47+
border-right: 7px solid transparent;
48+
opacity: 0;
49+
transition: all 0.08s ease;
50+
}
51+
52+
[wt-tooltip-content]:not([wt-tooltip-content=""]):hover::before {
53+
transform: scale(1);
54+
opacity: 1;
55+
}
56+
57+
[wt-tooltip-content]:not([wt-tooltip-content=""])[wt-tooltip-position~=bottom]::after {
58+
top: 100%;
59+
bottom: auto;
60+
margin: 10px 0 0;
61+
transform-origin: top center;
62+
}
63+
64+
[wt-tooltip-content]:not([wt-tooltip-content=""])[wt-tooltip-position~=align-right]::after,
65+
[wt-tooltip-content]:not([wt-tooltip-content=""])[wt-tooltip-position~=align-left]::after {
66+
transform: scale(0);
67+
-webkit-backdrop-filter: blur(1px);
68+
}
69+
70+
[wt-tooltip-content]:not([wt-tooltip-content=""])[wt-tooltip-position~=align-right]:hover::after,
71+
[wt-tooltip-content]:not([wt-tooltip-content=""])[wt-tooltip-position~=align-left]:hover::after {
72+
transform: scale(1);
73+
}
74+
75+
[wt-tooltip-content]:not([wt-tooltip-content=""])[wt-tooltip-position~=align-right]::after {
76+
margin-left: -16px;
77+
transform-origin: left top;
78+
}
79+
80+
[wt-tooltip-content]:not([wt-tooltip-content=""])[wt-tooltip-position~=align-left]::after {
81+
right: 50%;
82+
left: auto;
83+
margin-right: -16px;
84+
transform-origin: right top;
85+
}
86+
87+
[wt-tooltip-content]:not([wt-tooltip-content=""])[wt-tooltip-position~=bottom]::before {
88+
bottom: -10px;
89+
top: auto;
90+
transform-origin: center bottom;
91+
border-bottom: 7px solid rgba(64, 64, 64, 0.75);
92+
border-top: none;
93+
}
94+
95+
[wt-tooltip-content]:not([wt-tooltip-content=""])[wt-tooltip-position~=align-left][wt-tooltip-position~=bottom]::after {
96+
transform-origin: left top;
97+
}
98+
99+
[wt-tooltip-content]:not([wt-tooltip-content=""])[wt-tooltip-position~=align-right][wt-tooltip-position~=bottom]::after {
100+
transform-origin: right top;
101+
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
<a href="https://github.com/TheCodeRaccoons/WebflowTrickery/stargazers">
1515
<img alt="GitHub repository stars" src="https://img.shields.io/github/stars/TheCodeRaccoons/WebflowTrickery?color=%2360be86&label=github%20stars&style=for-the-badge">
1616
</a>
17+
<a href="#">
18+
<img alt="GitHub License" src="https://img.shields.io/github/license/TheCodeRaccoons/WebflowTrickery?color=%2360be86&style=for-the-badge">
19+
</a>
1720
</p>
1821
<br />
1922
<div align="center">

0 commit comments

Comments
 (0)