Compare commits
2 commits
234bc216c5
...
d56ee8dcee
Author | SHA1 | Date | |
---|---|---|---|
d56ee8dcee | |||
c2f931f06a |
2 changed files with 111 additions and 19 deletions
|
@ -64,19 +64,113 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main navigation, goes to code in page.html.twig
|
// Main navigation, goes to code in page.html.twig
|
||||||
details .burger-icon {
|
.hamburger-container {
|
||||||
transition: transform 0.1s;
|
width: max-content;
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
color: white;
|
||||||
|
transition: transform 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We don't need the checkbox to be visible, but we can't set it to display: none because this will break keyboard navigation. Instead set the opacity to 0 and the position to absolute so it doesn't push the rest of the content down */
|
||||||
|
.hamburger-container .checkbox {
|
||||||
|
opacity: 0;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show an outline when the hamburger is selected using the keyboard. Older browsers don't support :focus-visible, so we will just use :focus here. */
|
||||||
|
.hamburger-container .checkbox:focus ~ .hamburger {
|
||||||
|
/* Not all browsers support outline: auto, so set a sensible fallback outline. */
|
||||||
|
outline: 2px solid white;
|
||||||
|
outline: auto;
|
||||||
|
outline-offset: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For newer browsers that do support :focus-visible, hide the outline when the checkbox isn't selected with the keyboard. */
|
||||||
|
@supports selector(:focus-visible) {
|
||||||
|
.hamburger-container .checkbox:not(:focus-visible) ~ .hamburger {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide any focusable elements in the drawer by default to aid keyboard navigation. We use visibility so it makes the elements unfocusable, but doesn't affect the layout. We can also add a "transition" to visibility, which will make it show instantly when we open the drawer, but take half a second to hide it when we close the drawer. */
|
||||||
|
.hamburger-container .drawer a {
|
||||||
|
visibility: hidden;
|
||||||
|
transition: visibility 0.5s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make the focusable elements in the drawer visible when it is open. */
|
||||||
|
.hamburger-container .checkbox:checked ~ .drawer a {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hamburger-container .checkbox:checked ~ .drawer {
|
||||||
|
transform: translateX(0%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hamburger-container .checkbox:checked ~ .hamburger .slice:nth-child(1) {
|
||||||
|
transform: translateY(12px) rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hamburger-container .checkbox:checked ~ .hamburger .slice:nth-child(2) {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hamburger-container .checkbox:checked ~ .hamburger .slice:nth-child(3) {
|
||||||
|
transform: translateY(-12px) rotate(-45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hamburger {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
width: 1.5rem;
|
transition: transform 0.5s ease;
|
||||||
height: 1.5rem;
|
z-index: 1;
|
||||||
padding: .25rem;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
details[open] .burger-icon {
|
.hamburger .slice {
|
||||||
transform: rotate(90deg);
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 2px;
|
||||||
|
background-color: white;
|
||||||
|
transition: all 0.5s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
summary {
|
.hamburger .slice:not(:first-child) {
|
||||||
list-style-type: none;
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: max-content;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 22px;
|
||||||
|
background: black;
|
||||||
|
transform: translateX(-100%);
|
||||||
|
transition: transform 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer .nav-list {
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
margin-top: 30px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drawer .nav-list .nav-list-item {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make the drawer full-width on mobile */
|
||||||
|
@media screen and (max-width: 768px) {
|
||||||
|
.drawer {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -23,15 +23,14 @@
|
||||||
{% block navbar_branding %}
|
{% block navbar_branding %}
|
||||||
{{ page.navbar_branding }}
|
{{ page.navbar_branding }}
|
||||||
{% endblock navbar_branding %}
|
{% endblock navbar_branding %}
|
||||||
<nav class="navigation column">
|
<nav class="navigation column hamburger-container">
|
||||||
<details>
|
<input class="checkbox" type="checkbox" id="hamburger-toggle" aria-label="Toggle Navigation"/>
|
||||||
<summary>
|
<label class="hamburger" for="hamburger-toggle">
|
||||||
<div class="burger-icon"><svg aria-label="Navigation Menu" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
<span class="slice"></span>
|
||||||
<path d="M0 4h24M0 12h24M0 20h24" stroke="black" stroke-width="2" />
|
<span class="slice"></span>
|
||||||
</svg></div>
|
<span class="slice"></span>
|
||||||
</summary>
|
</label>
|
||||||
|
<div class="columns drawer">
|
||||||
<div class="columns">
|
|
||||||
{% block navbar_social %}
|
{% block navbar_social %}
|
||||||
{% if page.navbar_social %}
|
{% if page.navbar_social %}
|
||||||
<div class="column is-narrow">
|
<div class="column is-narrow">
|
||||||
|
@ -53,7 +52,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</details>
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
{% if is_front %}
|
{% if is_front %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue