Skip to content

Commit

Permalink
Merge pull request jonsuh#20 from andreamaiolo/dev-active-state
Browse files Browse the repository at this point in the history
Added sass variables for active state
  • Loading branch information
jonsuh authored Sep 25, 2018
2 parents ea5902d + ddd6ba4 commit 94fe82a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,15 @@ $hamburger-layer-border-radius : 4px;
$hamburger-hover-opacity : 0.7;
$hamburger-hover-transition-duration : 0.15s;
$hamburger-hover-transition-timing-function: linear;
$hamburger-active-layer-color : #8c8c8c;
$hamburger-active-hover-opacity : 1;

// To use CSS filters as the hover effect instead of opacity,
// set $hamburger-hover-use-filter as true and
// change the value of $hamburger-hover-filter accordingly.
$hamburger-hover-use-filter: false;
$hamburger-hover-filter : opacity(50%);
$hamburger-hover-use-filter : false;
$hamburger-hover-filter : opacity(50%);
$hamburger-active-hover-filter: opacity(100%);

// Remove or comment out the hamburger types you don’t want
// or need, so they get excluded from the compiled CSS.
Expand Down
17 changes: 17 additions & 0 deletions _sass/hamburgers/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@
opacity: $hamburger-hover-opacity;
}
}

&.is-active {
&:hover {
@if $hamburger-hover-use-filter == true {
filter: $hamburger-active-hover-filter;
}
@else {
opacity: $hamburger-active-hover-opacity;
}
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
background-color: $hamburger-active-layer-color;
}
}
}

.hamburger-box {
Expand Down
7 changes: 5 additions & 2 deletions _sass/hamburgers/hamburgers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ $hamburger-layer-border-radius : 4px !default;
$hamburger-hover-opacity : 0.7 !default;
$hamburger-hover-transition-duration : 0.15s !default;
$hamburger-hover-transition-timing-function: linear !default;
$hamburger-active-layer-color : #8c8c8c !default;
$hamburger-active-hover-opacity : 1 !default;

// To use CSS filters as the hover effect instead of opacity,
// set $hamburger-hover-use-filter as true and
// change the value of $hamburger-hover-filter accordingly.
$hamburger-hover-use-filter: false !default;
$hamburger-hover-filter : opacity(50%) !default;
$hamburger-hover-use-filter : false !default;
$hamburger-hover-filter : opacity(50%) !default;
$hamburger-active-hover-filter: opacity(100%) !default;

// Types (Remove or comment out what you don’t need)
// ==================================================
Expand Down
6 changes: 6 additions & 0 deletions dist/hamburgers.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
overflow: visible; }
.hamburger:hover {
opacity: 0.7; }
.hamburger.is-active:hover {
opacity: 1; }
.hamburger.is-active .hamburger-inner,
.hamburger.is-active .hamburger-inner::before,
.hamburger.is-active .hamburger-inner::after {
background-color: #8c8c8c; }

.hamburger-box {
width: 40px;
Expand Down
Loading

0 comments on commit 94fe82a

Please sign in to comment.