Fullscreen Responsive Menu with jQuery and CSS3 - hamburgler.js

Fullscreen Responsive Menu with jQuery and CSS3 - hamburgler.js
File Size: 2.13 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A minimal jQuery & CSS3 based navigation widget to create a responsive, fullscreen(full window) menu with hamburger icon animations.

Basic Usage:

1. Create a regular navigation menu using Html unordered list.

<ul class="mobilenav">
  <li><a href="#">jQuery</a></li>
  <li><a href="#">Script</a></li>
  <li><a href="#">Net</a></li>
  <li><a href="#">Menu</a></li>
  <li><a href="#">Demo Page</a></li>
</ul>

2. Create a icon to toggle the menu.

<ul class="mobilenav">
  <li><a href="#">jQuery</a></li>
  <li><a href="#">Script</a></li>
  <li><a href="#">Net</a></li>
  <li><a href="#">Menu</a></li>
  <li><a href="#">Demo Page</a></li>
</ul>

3. The CSS/CSS3 rules to animate the icon when toggled.

.top-animate {
  background: #fff !important;
  top: 13px !important;
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
}

.mid-animate { opacity: 0; }

.bottom-animate {
  background: #fff !important;
  top: 13px !important;
  -webkit-transform: rotate(-225deg);
  transform: rotate(-225deg);
}

.top-menu {
  top: 5px;
  width: 25px;
  height: 2px;
  border-radius: 10px;
  background-color: #fff;
}

.mid-menu {
  top: 13px;
  width: 25px;
  height: 2px;
  border-radius: 10px;
  background-color: #fff;
}

.bottom-menu {
  top: 21px;
  width: 25px;
  height: 2px;
  border-radius: 10px;
  background-color: #fff;
}

.menui {
  background: #fff;
  transition: 0.6s ease;
  transition-timing-function: cubic-bezier(.75, 0, .29, 1.01);
  margin-top: 10px;
  position: absolute;
}

.icon {
  z-index: 999;
  position: fixed;
  display: block;
  padding: 9px;
  height: 32px;
  width: 32px;
  margin: 0px;
  top: 0;
  left: 0;
}

4. The required CSS to style the navigation menu and to make it fullscreen.

.mobilenav {
  font-family: inherit;
  top: 0;
  left: 0;
  z-index: 999;
  display: none;
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba(26, 188, 9, 0.9);
  padding: 0;
  margin: 0;
}

.mobilenav li {
  list-style-type: none;
  text-align: center;
  padding: 10px;
}

.mobilenav li a {
  font-size: 150%;
  color: #fff;
  text-decoration: none;
  font-weight: 300;
  width: 100%;
}

.mobilenav li:first-child { margin-top: 60px; }

5. Include the latest version of jQuery library at the end of the web page.

<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>

6. Active the navigation menu with toggle icon hamburger transition effects.

$(document).ready(function () {
  $(".icon").click(function () {
    $(".mobilenav").fadeToggle(500);
    $(".top-menu").toggleClass("top-animate");
    $(".mid-menu").toggleClass("mid-animate");
    $(".bottom-menu").toggleClass("bottom-animate");
  });
});

This awesome jQuery plugin is developed by johnm. For more Advanced Usages, please check the demo page or visit the official website.