Make Header Navigation Sticky On Scroll Up - Shy Header

Make Header Navigation Sticky On Scroll Up - Shy Header
File Size: 4.86 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Shy Header is a smart sticky menu jQuery plugin that hides the header navigation on scroll down and makes it always be visible on scroll up.

How to use it:

1. Create a header navigation for your site.

<header class="header">
  Header Navigation Here
</header>

2. Include the Shy Header plugin after loading jQuery JavaScript library.

<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" 
        integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" 
        crossorigin="anonymous">
</script>
<script src="js/jquery.shyheader.js"></script>

3. Initialize the plugin on the header navigation.

$(function () {
  $(".shy-header").shyheader();
});

4. The CSS to stick the header navigation to the top on scroll up.

.shy-header {
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  -webkit-transition: all 200ms ease-out;
  transition: all 200ms ease-out;
}

5. The CSS for the show/hide animations.

.is-watching {
  -webkit-transform: translate3d(0,-100%,0);
  transform: translate3d(0,-100%,0);
}

6. Sometimes you might need to add an offset to the main container.

$(function () {
  $(".shy-header").shyheader();
});

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