Fullpage Navigation Menu with jQuery and CSS3 - Fullscreen Navbar
File Size: | 32.6 KB |
---|---|
Views Total: | 17674 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
A fullscreen navigation with an animated hamburger toggle that displays an always-centered menu with a fullscreen overlay covering the whole webpage, built using jQuery and CSS/CSS3.
How to use it:
1. Create a hamburger button to toggle the fullscreen navigation.
<div class="navbar-toggle" title="Menu"> <div class="bar1"></div> <div class="bar2"></div> <div class="bar3"></div> </div>
2. Create a nav list for your website.
<nav class="nav-hide"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Services</a></li> <li><a href="#">Blog</a></li> <li><a href="#">Contact</a></li> <li><a href="#">About</a></li> </ul> </nav>
3. Create a nav list for your website.
<nav class="nav-hide"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Services</a></li> <li><a href="#">Blog</a></li> <li><a href="#">Contact</a></li> <li><a href="#">About</a></li> </ul> </nav>
4. The CSS to style the fullscreen navigation.
nav, .navbar-toggle { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } nav { position: fixed; z-index: 10; background-color: rgba(231,76,60, 0.95); width: 100%; height: 100%; text-align: center; display: table; color: white; } .nav-hide { display: none; } nav ul { display: table-cell; vertical-align: middle; padding-left: 0 !important; } nav ul li { list-style: none; } nav ul li a { font-size: 35pt; color: inherit; font-weight: bolder; text-decoration: none; }
5. Animate the hamburger toggle using CSS3 transitions and transforms.
.navbar-toggle { position: fixed; top: 20px; right: 20px; width: 45px; height: 45px; z-index: 20; cursor: pointer; } .bar1, .bar2, .bar3 { width: 100%; height: 8px; margin-bottom: 5px; background-color: #1c1f72; transition: all 0.3s ease-in-out; } .navbar-on .bar1, .navbar-on .bar2, .navbar-on .bar3 { background-color: white; } .navbar-on .bar1 { transform-origin: 10% 40%; transform: rotate(45deg); } .navbar-on .bar3 { transform-origin: 10% 40%; transform: rotate(-45deg); } .navbar-on .bar2 { background-color: transparent; }
6. Load the latest version of jQuery library in your webpage.
<script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
7. The JavaScript to enable the fullscreen navigation.
$(function(){ $('.navbar-toggle, nav').click(function(){ $('.navbar-toggle').toggleClass('navbar-on'); $('nav').fadeToggle(); $('nav').removeClass('nav-hide'); }); });
This awesome jQuery plugin is developed by michellocana. For more Advanced Usages, please check the demo page or visit the official website.