Skip to content

Instantly share code, notes, and snippets.

@munkacsitomi
Created February 19, 2020 14:51
Show Gist options
  • Save munkacsitomi/98d614e8569faf95a043080456b2eeba to your computer and use it in GitHub Desktop.
Save munkacsitomi/98d614e8569faf95a043080456b2eeba to your computer and use it in GitHub Desktop.
Show/hide elements with transition
.first-example {
@include fade(show);
&--hide {
@include fade(hide);
}
}
.second-example {
@include fade(show);
&:hover {
@include fade(hide);
}
}
@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