Jonathan,
thank you for some really beautiful hamburgers! I made it work without Javascript:
I am using the squeeze variant in a hamburger menu which, instead of the proposed a tag, uses a label tag with associated hidden checkbox and :checked pseudo selector.
I replaced the &.is-active selector from the _base.scss and the _squeeze.scss file with a Sass variable $hamburger-activeClass and made it configurable like your other setting variables, and set its default to the original &.is-active value.
Here is my html:
<input class="hiddenToggle" id="toggle" type="checkbox" />
<label for="toggle" class="hamburger hamburger--squeeze">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</label>
<nav>
....
</nav>
The scss is:
.toggleMenu {
Nav
{
display: none;
}
.hiddenToggle
{ // don't hide so it is still accessible
position: absolute;
left: -9999px;
}
.hiddenToggle:checked ~ nav
{
display: block;
}
}
For above use case, I set the $hamburger-activeClass variable to .hiddenToggle:checked ~ & and it works like a charm.
If you think this would be a good overall function for hamburgers, let me know and I'll prepare a pull request with all hamburger variants adjusted with the new variable.
Regards, Mikael
Jonathan,
thank you for some really beautiful hamburgers! I made it work without Javascript:
I am using the squeeze variant in a hamburger menu which, instead of the proposed
atag, uses alabeltag with associated hidden checkbox and :checked pseudo selector.I replaced the
&.is-activeselector from the_base.scssand the_squeeze.scssfile with a Sass variable$hamburger-activeClassand made it configurable like your other setting variables, and set its default to the original&.is-activevalue.Here is my html:
The scss is:
For above use case, I set the
$hamburger-activeClassvariable to.hiddenToggle:checked ~ &and it works like a charm.If you think this would be a good overall function for hamburgers, let me know and I'll prepare a pull request with all hamburger variants adjusted with the new variable.
Regards, Mikael