JSFiddle - React, Tailwind, and code Playground
HTML
<nav id="testMenu">
<div class="border top"></div>
<div class="border bottom"></div>
<div class="border left"></div>
<div class="border right"></div>
<button class="c-hamburger c-hamburger--htx"> <span>toggle menu</span>
</button>
<ul id="yellowMenu">
<li><a href="">PROJECTS</a>
</li>
<li><a href="">ABOUT</a>
</li>
<li><a href="">SERVICE</a>
</li>
<li><a href="">CONTACT</a>
</li>
</ul>
</nav>
CSS
ul, li {
list-style: none;
}
#yellowMenu {
background: #fafd37;
font-size: 2em;
text-align: center;
position: absolute;
left: 0;
top: 18px;
right: 0;
bottom: 0;
height: 100%;
display: none;
}
#yellowMenu a {
color: black;
text-decoration: none;
width: 100%;
height: 2em;
display: block;
line-height: 2.1;
font-family:'FF_Super_Grotesk';
font-weight: normal;
font-style: normal;
transition: background-color 2s ease;
}
#yellowMenu a:hover {
color: #e0e0d4;
background: rgba(182, 182, 157, 0.7);
}
/* Body border */
/* https://www.youtube.com/watch?v=HbkOzrpmhUc https://css-tricks.com/body-border/ */
body {
padding: 0px;
}
.border {
position: fixed;
background: #f9f8f3;
}
.top, .bottom {
left: 0;
right: 0;
height: 50px;
}
.top {
top: 0;
}
.bottom {
bottom: 0;
}
.right, .left {
top: 0;
bottom: 0;
width: 50px;
}
.right {
right: 0;
}
.left {
left: 0;
}
/* End of -->> Body border */
/* Nav */
.c-hamburger {
display: block;
position: fixed;
left: 0px;
bottom: 0px;
overflow: hidden;
top: 0;
margin: 0;
padding: 0;
width: 50px;
height: 50px;
font-size: 0;
text-indent: -9999px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
box-shadow: none;
border-radius: none;
border: none;
cursor: pointer;
-webkit-transition: background 0.3s;
transition: background 0.3s;
z-index: 5;
}
.c-hamburger:focus {
outline: none;
}
.c-hamburger span {
display: block;
position: absolute;
top: 25px;
left: 12px;
right: 12px;
height: 2px;
background: #262626;
}
.c-hamburger span::before, .c-hamburger span::after {
position: absolute;
display: block;
left: 0;
width: 100%;
height: 2px;
background-color: #262626;
content:"";
}
.c-hamburger span::before {
top: -7px;
}
.c-hamburger span::after {
...
JavaScript
(function () {
"use strict";
var toggles = document.querySelectorAll(".c-hamburger");
for (var i = toggles.length - 1; i >= 0; i--) {
var toggle = toggles[i];
toggleHandler(toggle);
};
function toggleHandler(toggle) {
toggle.addEventListener("click", function (e) {
e.preventDefault();
(this.classList.contains("is-active") === true) ? this.classList.remove("is-active") : this.classList.add("is-active");
});
}
})();