css - JQuery Scroll controls opacity of a Nav to fade in, how to stop Nav fading out on reverse scroll? -


i in need of jquery. have fixed nav @ top of page thats opacity set 0 on page load. when page scrolled down nav fades in using:

function easypeasyparallax() {     scrollpos = $(this).scrolltop(); $('#nav').css({         'opacity': 0+(scrollpos/800)     }); }); 

how can make when page scrolled doesn't fade out?

i have tried doing if statement jquery isn't hot.

thanks in advance. edd neal.

try this:

$(document).ready(function(){     $(window).scroll(function(){         if($(this).scrolltop() > 200){              $('#nav').fadein(1000);            }     }); }); 

with css:

#nav{     display:none;     position:fixed;     top:0px;     left:0px;     width:100%;     height:50px;     background-color:red; } 

a working jsfiddle can found here.

using fadein() better manually changing css because jquery takes care of cross browser css issues automatically. example, opacity ie alpha(opacity=50)


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -