Smart Auto Show/Hide Bootstrap Navbar - jQuery navstrap

Smart Auto Show/Hide Bootstrap Navbar - jQuery navstrap
File Size: 16.7 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

navstrap is a small jQuery plugin to create a smart Bootstrap navbar that makes the sticky Bootstrap navigation bar auto show/hide as you scroll down or up the webpage.

How to use it:

1. Put the minified version of the jQuery navstrap plugin to your Bootstrap webpage as this:

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

2. Create a default Bootstrap navbar for your webpage.

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">
      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#navbar-top" aria-expanded="false"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
      <a class="navbar-brand" href="/">Brand</a>
    </div>
    <div class="collapse navbar-collapse" id="navbar-top">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#" data-toggle="collapse" data-target=".navbar-collapse.in">Contact</a></li>
        <li><a href="#" data-toggle="collapse" data-target=".navbar-collapse.in">About</a></li>
      </ul>
    </div>
  </div>
</nav>

3. Initialize the plugin on the Bootstrap navbar. That's it.

$('.navbar').NavStrap().ShowOrHideOnScroll();

4. Add a shadow effect to the Bootstrap navbar.

$('.navbar').NavStrap().ShowOrHideOnScroll({
  shadow: true
});

5. More configuration options.

$('.navbar').NavStrap().ShowOrHideOnScroll({
  delta: 5,
  speed: 250
});

Change log:

2017-08-01


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