javascript dropdown mobile-nav

In this example below you will see how to do a javascript dropdown mobile-nav with some HTML / CSS and Javascript

This awesome code was written by 1zm0, you can see more from this user in the personal repository.
You can find the original code on
Copyright 1zm0 ©
  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

  <meta charset="UTF-8">
  <title>javascript dropdown mobile-nav</title>
      <link rel="stylesheet" href="css/style.css">



  <div id="hamburger">

  <ul id="list">
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Profile</a></li>
    <li><a href="#">Contact</a></li>

    <script  src="js/index.js"></script>



/*Downloaded from */
#hamburger {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 50px;
  height: 35px;

span {
  width: 50px;
  height: 5px;
  margin: 3px;
  background-color: black;
  border-radius: 15px;

ul.yay {
  display: flex;
  flex-direction: column;
  opacity: 1;
  list-style-type: none;
  width: 55px;
  transition: .25s ease-in-out;
  margin: 0;
  padding: 0;
  margin-top: 10px;
  justify-content: flex-start;
  align-items: flex-start;
ul li a {
  text-decoration: none;
  color: black;
ul li a:hover {
  color: green;
ul {
  opacity: 0;

/*Downloaded from */
var hamburger = document.getElementById("hamburger");
var element = document.getElementById("list");

hamburger.addEventListener("click", function() {