Sticky Header Navigation Plugin jQuery mhead - Free Download Smart Sticky Header Hamburger Navigation Plugin - jQuery mhead

Free Download Smart Sticky Header Hamburger Navigation Plugin – jQuery mhead

Posted on

This time I will share jQuery Plugin and tutorial about Smart Sticky Header Hamburger Navigation Plugin – jQuery mhead, hope it will help you in programming stack.

Sticky Header Navigation Plugin jQuery mhead - Free Download Smart Sticky Header Hamburger Navigation Plugin - jQuery mhead
File Size: 93.1 KB
Views Total: 11615
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

mhead is a jQuery plugin used to create a sticky header hamburger navigation for your web application that auto shows/hides as you scroll/swipe the page down or up.

Liccensed under the CC-BY-4.0 license.

How to use it:

1. The plugin depends on jQuery library and jQuery mmenu plugin.

1 <script src="/path/to/jquery.js"></script>
2 <link rel="stylesheet" href="/path/to/jquery.mmenu.all.css">
3 <script src="/path/to/jquery.mmenu.all.js"></script>

2. Load the mhead plugin’s JS and CSS files in the document.

1 <link rel="stylesheet" href="jquery.mhead.css">
2 <script src="jquery.mhead.js"></script>

3. Load the latest Font Awesome for the navigation icons.

1 <link rel="stylesheet" href="/path/to/font-awesome.min.css">

4. Create the header navigation bar with the following CSS classes:

  • .mh-head: required
  • .mh-size-2/3: enlarges the header nav two or three times
  • .mh-align-left/right: aligns the text or logo to the left or right.
  • .mh-btns-left/right: aligns the toggle button to the left or right.
  • .mh-btns-2/3-left/right: enlarges the toggle button two or three times
  • .mh-hamburger: transforms the toggle button into a hamburger button
  • .mh-text: header text
  • .mh-list: scrollable list
  • .mh-form: search field
  • .mh-logo: site logo
  • .mh-image: background image
1 <div class="mh-head Sticky" id="example">
2   <span class="mh-btns-left">
3     <a class="fa fa-bars" href="#menu"></a>
4   </span>
5   <span class="mh-text">demo</span>
6 </div>

5. Inert your own menu items to the navigation.

01 <nav id="menu">
02   <ul>
03     <li><a href="#">Home</a></li>
04     <li><span>About us</span>
05       <ul>
06         <li><a href="#">History</a></li>
07         <li><span>The team</span>
08           <ul>
09             <li><a href="#">Management</a></li>
10             <li><a href="#">Sales</a></li>
11             <li><a href="#">Development</a></li>
12           </ul>
13         </li>
14         <li><a href="#">Our address</a></li>
15       </ul>
16     </li>
17     <li><a href="#">Contact</a></li>
18   </ul>
19 </nav>

6. Initialize the plugin with default settings and we’re done.

1 //  create a menu
2 $('#menu').mmenu();
3  
4 //  fire the plugin
5 $('.mh-head').mhead();

7. All default settings to customize the header navigation.

01 $('.mh-head').mhead({
02  
03   scroll: {
04  
05     // amount of pixels to scroll down before hiding the header nav
06     hide: 0,
07  
08     // amount of pixels to scroll down before showing the header nav
09     show: 0,
10  
11     // minimum amount of pixels to scroll per scroll-event before showing or hiding the header nav
12     tolerance: 4
13  
14   },
15  
16   hamburger: {
17  
18     // query selector for the menu that should be opened when clicking the hamburger icon
19     // if omitted, the plugin will use the anchor href attribute or target the first mmenu menu that it finds
20     menu: null,
21  
22     // animation type
23     animation: "collapse"
24  
25   }
26    
27 });

Changelog:

2020-08-18

  • v2.1.0

2018-06-13

  • v1.0.2

 


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