Skip to content

Commit cdbde06

Browse files
alxnjekyllbot
authored andcommitted
Fixes #80, #106. Make the hamburger work with pure CSS. (#111)
Merge pull request 111
1 parent 9e0accc commit cdbde06

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

_includes/header.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77

88
{% if page_paths %}
99
<nav class="site-nav">
10-
<span class="menu-icon">
11-
<svg viewBox="0 0 18 15" width="18px" height="15px">
12-
<path fill="#424242" d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.031C17.335,0,18,0.665,18,1.484L18,1.484z"/>
13-
<path fill="#424242" d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484 h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z"/>
14-
<path fill="#424242" d="M18,13.516C18,14.335,17.335,15,16.516,15H1.484C0.665,15,0,14.335,0,13.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z"/>
15-
</svg>
16-
</span>
10+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
11+
<label for="nav-trigger">
12+
<span class="menu-icon">
13+
<svg viewBox="0 0 18 15" width="18px" height="15px">
14+
<path fill="#424242" d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.031C17.335,0,18,0.665,18,1.484L18,1.484z"/>
15+
<path fill="#424242" d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484 h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z"/>
16+
<path fill="#424242" d="M18,13.516C18,14.335,17.335,15,16.516,15H1.484C0.665,15,0,14.335,0,13.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z"/>
17+
</svg>
18+
</span>
19+
</label>
1720

1821
<div class="trigger">
1922
{% for path in page_paths %}

_sass/minima/_layout.scss

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
float: right;
2929
line-height: 56px;
3030

31+
.nav-trigger {
32+
display: none;
33+
}
34+
3135
.menu-icon {
3236
display: none;
3337
}
@@ -51,6 +55,15 @@
5155
border-radius: 5px;
5256
text-align: right;
5357

58+
label[for="nav-trigger"] {
59+
display: block;
60+
float: right;
61+
width: 36px;
62+
height: 36px;
63+
z-index: 2;
64+
cursor: pointer;
65+
}
66+
5467
.menu-icon {
5568
display: block;
5669
float: right;
@@ -65,12 +78,12 @@
6578
}
6679
}
6780

68-
.trigger {
81+
input ~ .trigger {
6982
clear: both;
7083
display: none;
7184
}
7285

73-
&:hover .trigger {
86+
input:checked ~ .trigger {
7487
display: block;
7588
padding-bottom: 5px;
7689
}

0 commit comments

Comments
 (0)