-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#111] Redefine Tooltips using only CSS
We just removed 30 KB from the generated script...
- Loading branch information
Showing
13 changed files
with
138 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@import "variables"; | ||
@import "../_variables"; | ||
|
||
//* The basics of icons */ | ||
.icon, .bev-icon, .moment-icon { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Inspired from https://chrisbracco.com/a-simple-css-tooltip/ | ||
|
||
//* Base styles for the element that has a tooltip */ | ||
//[data-tooltip], | ||
.tooltip { | ||
position: relative; | ||
cursor: pointer; | ||
|
||
//* Base styles for the entire tooltip */ | ||
&:before, &:after { | ||
position: absolute; | ||
visibility: hidden; | ||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); | ||
opacity: 0; | ||
transition: opacity 0.2s ease-in-out, | ||
visibility 0.2s ease-in-out, | ||
transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24); | ||
transform: translate3d(0, 0, 0); | ||
pointer-events: none; | ||
} | ||
|
||
//* Show the entire tooltip on hover and focus */ | ||
&:hover, &:focus { | ||
&:before, &:after { | ||
visibility: visible; | ||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); | ||
opacity: 1; | ||
} | ||
} | ||
|
||
//* Base styles for the tooltip's directional arrow */ | ||
&:before { | ||
z-index: 1001; | ||
border: 6px solid transparent; | ||
background: transparent; | ||
content: ""; | ||
} | ||
|
||
//* Base styles for the tooltip's content area */ | ||
&:after { | ||
z-index: 1000; | ||
padding: 8px; | ||
width: 160px; | ||
background-color: #000; | ||
background-color: hsla(0, 0%, 20%, 0.9); | ||
color: #fff; | ||
content: attr(data-tooltip); | ||
font-size: 14px; | ||
line-height: 1.2; | ||
} | ||
|
||
//* Bottom tooltips only */ | ||
&:before, &:after { | ||
top: 100%; | ||
bottom: auto; | ||
left: 50%; | ||
} | ||
|
||
&:before { | ||
margin-top: -12px; | ||
margin-bottom: 0; | ||
border-top-color: transparent; | ||
border-bottom-color: #000; | ||
border-bottom-color: hsla(0, 0%, 20%, 0.9); | ||
} | ||
|
||
&:focus, &:hover { | ||
&:before, &:after { | ||
transform: translateY(12px); | ||
} | ||
} | ||
|
||
// Horizontally align top/bottom tooltips | ||
&:after { | ||
margin-left: -80px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters