メニューボタンを押したら右側からナビゲーションが出てくるサンプルです。
サンプルではFontAwesomeのアイコンフォントを使っています。
HTML
<nav class="hamburger-nav">
<input type="checkbox" id="nav-toggle" class="nav-toggle-selecter">
<ul class="nav-list">
<li><a href="">HOME</a></li>
<li><a href="">INFORMATION</a></li>
<li><a href="">PRODUCTS</a></li>
<li><a href="">ABOUT</a></li>
<li><a href="">INQUIRY</a></li>
</ul>
<label for="nav-toggle" class="nav-toggle-button"></label>
</nav><!-- /.hamburger-nav -->
SASS
/*---------------------------------------------
Hamburger Nav
---------------------------------------------*/
.hamburger-nav {
margin-top: 1.5em;
width: 30px;
text-align: right;
}
.nav-list {
display: none;
position: absolute;
top: 0;
right: -20px;
z-index: 1;
width: 240px;
height: 100vh;
box-sizing: border-box;
list-style: none;
margin: 0;
padding: 60px 0 30px;
background: rgba(black, .95);
text-align: left;
> li {
a {
display: block;
padding: 10px 1em;
text-decoration: none;
color: rgba(white, 1);
}
}
}
.nav-toggle-button {
cursor: pointer;
&::before {
font-family: 'FontAwesome';
content: '\f0c9';
}
}
.nav-toggle-selecter {
display: none;
&:checked {
+ .nav-list {
display: block;
animation: showAni .5s ease 0s 1 normal;
@keyframes showAni {
0% { right: -240px; }
100% { right: -20px; }
}
+ .nav-toggle-button::before {
position: relative;
z-index: 2;
color: rgba(white, 1);
content: '\f00d';
}
}
}
}