Created
February 19, 2020 14:51
-
-
Save munkacsitomi/98d614e8569faf95a043080456b2eeba to your computer and use it in GitHub Desktop.
Show/hide elements with transition
This file contains hidden or 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
.first-example { | |
@include fade(show); | |
&--hide { | |
@include fade(hide); | |
} | |
} | |
.second-example { | |
@include fade(show); | |
&:hover { | |
@include fade(hide); | |
} | |
} |
This file contains hidden or 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
@mixin fade($type) { | |
@if $type == 'hide' { | |
visibility: hidden; | |
opacity: 0; | |
transition: visibility 1s, opacity 1s; | |
} | |
@else if $type == 'show' { | |
visibility: visible; | |
opacity: 1; | |
transition: visibility 1s, opacity 1s; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment