//
// shy-navbar.js - Add “shyness” into your navigation bar.
// https://github.com/lqez/shy-navbar
//
// usage : $("#navbar").shy();
//
(function ($) {
    $.fn.shy = function(options) {
        // Change these variables to suit your favor.
        var settings = $.extend({
            thresholdUp: 10,
            thresholdDown: 80,
            animationDelay: 250,
            animationDur: 150
        }, options);

        var $this = $(this);
        $this.css({
            'position': 'absolute',
                 'top': '0',
             'z-index': '1'
        });
        var lastScrollTop = 0;

        $(window).scroll(function () { 
            var position = $this.css('position');
            var height = $this.height();
            var scrollTop = $(this).scrollTop()

            if( scrollTop <= 0 ) {
                $this.clearQueue().css({ top: 0, position: 'absolute' });
            } else {
                if( scrollTop < lastScrollTop ) {
                    if( position != 'fixed' && ( scrollTop + settings.thresholdDown < lastScrollTop ) ) {
                        $this.clearQueue()
                            .css({ top: '-'+height+'px', position: 'fixed' })
                            .delay(settings.animationDelay).animate({ top: 0 }, settings.animationDur);
                    }
                } else if( position == 'fixed' && ( scrollTop - settings.thresholdUp > lastScrollTop ) ) {
                    $this.clearQueue()
                        .delay(settings.animationDelay).animate({ top: '-'+height+'px' }, settings.animationDur, function() { 
                            $(this).clearQueue().css({ top: 0, position: 'absolute' });
                        });
                }
            }
            lastScrollTop = scrollTop;
        });
    }
}(jQuery));

@@ -177,24 +177,134 @@
 (options) %7B%0A
+        if (options == 'off' %7C%7C options == 'brave') %7B%0A            this.brave();%0A            return;%0A        %7D%0A
         // C
@@ -544,23 +544,20 @@
 $this = 
-$(
 this
-)
 ;%0A      
@@ -562,56 +562,135 @@
     
-$this.css(%7B%0A            'position': 'absolute',%0A
+var lastScrollTop = 0;%0A        var shy = %7B%0A            previousStyles: %7B%0A                'position': this.css('position'),%0A    
     
@@ -713,13 +713,29 @@
 p': 
-'0',%0A
+this.css('top'),%0A    
     
@@ -758,11 +758,27 @@
 x': 
-'1'
+this.css('z-index')
 %0A   
@@ -786,69 +786,36 @@
     
-%7D);%0A
     
+%7D,%0A
     
-var lastScrollTop = 0;%0A%0A        $(window).scroll(
+        handler: 
 func
@@ -819,26 +819,29 @@
 unction () %7B
- 
 %0A
+    
             
@@ -886,24 +886,28 @@
             
+    
 var height =
@@ -931,24 +931,28 @@
             
+ 
+   
 var scrollTo
@@ -980,32 +980,36 @@
 ()%0A%0A            
+   
+ 
 if( scrollTop %3C=
@@ -1011,24 +1011,28 @@
 op %3C= 0 ) %7B%0A
+    
             
@@ -1101,24 +1101,28 @@
             
+    
 %7D else %7B%0A   
@@ -1118,16 +1118,20 @@
  else %7B%0A
+    
         
@@ -1188,24 +1188,28 @@
             
+    
 if( position
@@ -1298,32 +1298,36 @@
                 
+    
 $this.clearQueue
@@ -1321,32 +1321,36 @@
 is.clearQueue()%0A
+    
                 
@@ -1431,32 +1431,36 @@
                 
+ 
+   
 .delay(settings.
@@ -1519,16 +1519,20 @@
 onDur);%0A
+    
         
@@ -1557,24 +1557,28 @@
             
+    
 %7D else if( p
@@ -1668,32 +1668,36 @@
                 
+  
+  
 $this.clearQueue
@@ -1691,32 +1691,36 @@
 is.clearQueue()%0A
+    
                 
@@ -1858,16 +1858,20 @@
         
+    
 $(this).
@@ -1942,28 +1942,36 @@
             
+   
+ 
 %7D);%0A
+    
             
@@ -1980,34 +1980,42 @@
   %7D%0A            
-%7D%0A
+    %7D%0A    
             last
@@ -2049,17 +2049,573 @@
     
-%7D);%0A
     %7D
+%0A        %7D;%0A%0A        this.data('shy', shy);%0A        this.css(%7B%0A            'position': 'absolute',%0A                 'top': '0',%0A             'z-index': '1'%0A        %7D);%0A        $(window).on('scroll', shy.handler);%0A    %7D;%0A%0A    $.fn.brave = function() %7B%0A        var shy = this.data('shy');%0A%0A        if (shy && typeof shy.handler == 'function') %7B%0A            $(window).off('scroll', shy.handler);%0A            this.clearQueue();%0A            for (var key in shy.previousStyles) %7B%0A                this.css(key, shy.previousStyles%5Bkey%5D);%0A            %7D%0A        %7D%0A    %7D;
 %0A%7D(j

Add $.fn.brave() function to remove the shy effect.