Modern Animated Toggle Menu With JavaScript and CSS3

Animated Navigation is a modern toggle menu built with JavaScript and CSS3 transitions.

toggle menu javascript, hamburger menu css responsive, toggle menu example, build a javascript animated navigation toggle, hamburger menu css animation

How to make use of it:

1. Create a nav listing with a toggle button on the web page.

<nav class="active" id="nav">
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">Works</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Contact</a></li>
  </ul>
  <button class="icon" id="toggle">
    <div class="line line1"></div>
    <div class="line line2"></div>
  </button>
</nav>

2. The essential CSS for the toggle menu.

nav {
  background-color: white;
  padding: 20px;
  width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  transition: width 0.6s linear;
}

nav.active {
  width: 350px;
}

nav ul {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  width: 0;
  transition: width 0.6s linear;
}

nav.active ul {
  width: 100%;
}

nav ul li {
  transform: rotateY(0deg);
  opacity: 0;
  transition: transform 0.6s linear, opacity 0.6s linear;
}

nav.active ul li {
  opacity: 1;
  transform: rotateY(360deg);
}

nav ul a {
  position: relative;
  color: black;
  text-decoration: none;
  margin: 0 10px;
}

3. Style the toggle button.

.icon {
  background-color: white;
  border: none;
  cursor: pointer;
  position: relative;
  height: 30px;
  width: 30px;
}

.icon:focus {
  outline: none;
}

.icon .line {
  background-color: #5290f9;
  height: 2px;
  width: 20px;
  position: absolute;
  top: 10px;
  left: 5px;
  transition: transform 0.6s linear;
}

.icon .line2 {
  top: auto;
  bottom: 10px;
}

nav.active .icon .line1 {
  transform: rotate(-765deg) translateY(5.5px);
}

nav.active .icon .line2 {
  transform: rotate(765deg) translateY(-5.5px);
}

4. Enable the toggle button to develop & collapse the menu.

const toggle = document.getElementById('toggle');
const nav = document.getElementById('nav');
toggle.addEventListener('click', () => {
    nav.classList.toggle('active')
});

Animated Toggle Menu, Animated Navigation Plugin/Github, hamburger menu css, hamburger menu css only


See Demo And Download

Official Website(Bryanauta): Click Here

This superior jQuery/javascript plugin is developed by Bryanauta. For extra Advanced usage, please go to the official website.

Related Posts

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Bootstrap-4-Sidebar-Menu-Responsive-Template

Bootstrap 4 Sidebar Menu Responsive Template | MDB

Bootstrap Side Navbar – Responsive sidebar template based on the Bootstrap 4 framework. An easy-to-use, totally responsive, Google Material Design impressed aspect navigation for modern web app…

Bootstrap-4-Toast-Notification-Plugin

Lightweight Bootstrap 4 Toast Notification Plugin | BS4 Advanced Toast

A lightweight Bootstrap 4 Toast Notification plugin integrated with JS/jQuery. bs4-toast.js is a JavaScript library that enhances the native Bootstrap toast component with icons, buttons, callbacks, and…

Audio-Visualizations-Wave

How to Create Audio Visualizations with JavaScript | Wave.js

Audio Visualizer Library – wave.js is a vanilla javascript audio visualization library that provides 20+ creative audio visualization effects to bring more engagement to your visitor. Contribute…

bootstrap-5-treeview

Bootstrap 5 Treeview Dynamically Collapsible | bs5treeview

Bootstrap 5 Tree View is a very simple plug-in for creating a basic and elegant Treeview using BS5. For use with Bootstrap 5, the attributes have been…

Leave a Reply

Your email address will not be published. Required fields are marked *