This time I will share jQuery Plugin and tutorial about jQuery Plugin For Fixed Navigation Based On Scroll Direction – Semi-Sticky, hope it will help you in programming stack.
Semi-Sticky is a jQuery plugin to create a fixed navigation bar that shows/hides part of itself based on scroll direction.
How to use it:
1. Load the jQuery semi-sticky plugin after you have jQuery library included.
1 |
< script src = "//code.jquery.com/jquery-1.11.3.min.js" ></ script > |
2 |
< script rc = "src/semisticky.js" ></ script > |
2. Create a navigation for your website. The navigation consists of two parts: the main navigation bar + a bar with some secondary links. The main navigation is always visible, but the secondary links are hidden/revealed when the user scrolls down/up. A scrolling threshold must be reached before the hide/reveal interaction takes place.
02 |
< div class = "nav-actions" > |
04 |
< li >Secondary Link 1</ li > |
05 |
< li >Secondary Link 2</ li > |
06 |
< li >Secondary Link 3</ li > |
08 |
< div class = "clear" ></ div > |
10 |
< div class = "nav-main" > |
11 |
< div class = "logo" >Awesome logo</ div > |
17 |
< div class = "clear" ></ div > |
3. Initialize the plugin.
2 |
offsetLimit: $( '.nav-actions' ).outerHeight(), |
4. Available optiopns.
04 |
offsetLimit: element.outerHeight(), |
Change log:
2015-11-23
- Switch delta calculation so scrolling down results in a positive number
This awesome jQuery plugin is developed by wosephjeber. For more Advanced Usages, please check the demo page or visit the official website.