Skip to content

Commit

Permalink
Added extra transition rules variable
Browse files Browse the repository at this point in the history
  • Loading branch information
kapoko committed Jan 4, 2021
1 parent 0e21e30 commit 09edd42
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ $hamburger-animation-speed: 1; // The timings of the animations
$hamburger-class-name: 'hamburger' // The main class and prefixes of the animation classes
// can be changed. This allows for different styled buttons on the
// same page.
$hamburger-extra-transition-rules: &; // = null. If you need extra transition rules on the base element
// you can set this variable and it gets appended. This way you don't
// need to overwrite the plugin transition rules. Example:
// $hamburger-extra-transition-rules: box-shadow 0.15s ease-in-out;
```

#### Select which animations to compile by variable
Expand Down
3 changes: 2 additions & 1 deletion scss/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ div.#{$hamburger-class-name} {
}

.#{$hamburger-class-name} {
$base-transitions: opacity $hamburger-opacity-transition-speed $hamburger-easing, background $hamburger-background-transition-speed $hamburger-easing;
background-color: $hamburger-background;
border: $hamburger-border-width $hamburger-border-color solid;
border-radius: $hamburger-border-radius;
Expand All @@ -36,7 +37,7 @@ div.#{$hamburger-class-name} {
overflow: visible;
padding: $hamburger-padding;
text-transform: none;
transition: opacity $hamburger-opacity-transition-speed $hamburger-easing, background $hamburger-background-transition-speed $hamburger-easing;
transition: append($base-transitions, $hamburger-extra-transition-rules);

&:hover {
background-color: $hamburger-background-hover;
Expand Down
1 change: 1 addition & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ $hamburger-border-radius: 0 !default;
$hamburger-bar-border-radius: 0 !default;
$hamburger-bar-spacing: round($hamburger-size / 5) !default;
$hamburger-animation-speed: 1 !default;
$hamburger-extra-transition-rules: & !default;

// Animation types. Use this as a variable and remove the animations
// you don't need so they won't get compiled in your css.
Expand Down

0 comments on commit 09edd42

Please sign in to comment.