javascript - "slide up" nav menu on scroll-down, and appear as soon as scroll up -


i want nav menu slide level scroll down, , reappear scroll up. want following menu: http://www.defringe.com/ if notice, when slide down, can still notice tip of menu.

now able find far code hides menu completely. here code:

html:

<header id="header-wrap"> <nav id="topnav">     <ul>       <li>point1</li>       <li>point2</li>       <li>point3</li>       <li>point4</li>     </ul> </nav> 

css:

#topnav{ position:absolute; margin:auto; padding-top:20px; height:60px; width:576px; bottom: 0;}  #header-wrap{ background:#f1f2f2; height:60px; position:fixed; width:100%;} 

jquery:

 $(function(){     $('header').data('size','big');    var previousscroll = 0;     headerorgoffset = $('#topnav').height()  $('#header-wrap').height($('#topnav').height()); });  $(window).scroll(function () {     var currentscroll = $(this).scrolltop();     if (currentscroll > headerorgoffset) {         if (currentscroll > previousscroll) {             $('#header-wrap').slideup("fast");         } else {             $('#header-wrap').slidedown("fast");         }     }      previousscroll = currentscroll; }); 

thanks!

in case not want slideup / slidedown rather build own function slides menu bit -margin

somnething like

$(window).scroll(function () { var currentscroll = $(this).scrolltop(); if (currentscroll > headerorgoffset) {     if (currentscroll > previousscroll) {         // menu height 100px         $('#header-wrap').css("margin-top", "-90px");     } else {         $('#header-wrap').css("margin-top", "0");     } }  previousscroll = currentscroll; }); 

obviously need format menu properly, have fixed etc, should trick. if not sure how make work, let me know , can completely.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -