Last active
August 29, 2015 13:57
-
-
Save momolog/9640080 to your computer and use it in GitHub Desktop.
pure CSS show / hide
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
<div id="container" class="outline outline-big toggle-on-hover-switch"> | |
<b>.toggle-on-hover-switch</b> | |
<div id="out" class="outline toggle-on-hover-hide"> | |
<b>.toggle-on-hover-hide</b><br/> | |
I disappear. | |
I disappear. | |
I disappear. | |
I disappear. | |
</div> | |
<div id="in" class="outline toggle-on-hover-show"> | |
<b>.toggle-on-hover-show</b><br/> | |
I appear. | |
I appear. | |
I appear. | |
I appear. | |
</div> | |
</div> |
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
.toggle-on-hover-visible | |
visibility: visible | |
opacity: 1 | |
max-height: 9999px | |
.toggle-on-hover-invisible | |
visibility: hidden | |
opacity: 0 | |
max-height: 0 | |
.toggle-on-hover-switch | |
.toggle-on-hover-show | |
@extend .toggle-on-hover-invisible | |
+transition(visibility 0s $transtime, opacity $transtime, max-height 0s $transtime) | |
.toggle-on-hover-hide | |
@extend .toggle-on-hover-visible | |
+transition(visibility 0s linear 0s, opacity $transtime, max-height 0s linear 0s) | |
&:hover | |
& .toggle-on-hover-show | |
@extend .toggle-on-hover-visible | |
+transition(visibility 0s linear 0s, opacity $transtime, max-height 0s linear 0s) | |
& .toggle-on-hover-hide | |
@extend .toggle-on-hover-invisible | |
+transition(visibility 0s $transtime, opacity $transtime, max-height 0s $transtime) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment