How to make menu slide nav with html, CSS and JavaScript

https://youtu.be/gfex0Rjm5Y4

Creating slide menu bar is quite easy...... follow or copy and paste the code on your editor

Body:

<body>
   <div id="mySidenav" class="sidenav">
   <ul>
     <li><a href="JavaScript:void(0)" onclick="closeNav()" id="closebttn">&times</a></li>
     <li><a href="#">Home</a></li>
     <li><a href="#">Service</a></li>
     <li><a href="#">Contact</a></li>
     <li><a href="#">Terms</a></li>
</ul>
</div>
   <span onclick="openNav()">&#9776</span>

</body>

Css:

<style>

* {
  margin:0;
  padding:0;
}
    .sidenav {
      height:100%;
      width:0;
      overflow:hidden;
      position:fixed;
      background-color:red;
      z-index:0;
      transition:0.5s;
}
   ul {
     list-style:none;
}
    .sidenav li a {
       text-decoration:none;
       color:white;
}
   #closebttn {
      position: absolute;
      top:0;
      right:25px;
}
  </style>


JavaScript:

<script>
   function openNav() {
  document.getElementById("mySidenav").style.width="100px";
}
function closeNav() {
  document.getElementById("mySidenav").style.width="0";
}
  </script>


Comments

Popular posts from this blog

How to Borrow Airtime and Data from Glo: A Step-by-Step Guide in Pidgin English

Fiverr Guide: Fiverr Account creation, How to Create Gigs, Low Competitive & High Demanding Gigs and Prevent Account Disabling

250$ Everyday with Rapidworker - How to Hammer with Rapidworker: Make Money Online Eazy Eazy