javascript - Making a navbar disappear -
i hope question have not been asked before.
first of all, wanted navbar appear after specific number of pixels , found that:
<script type="text/javascript"> (function($) { $(document).ready(function(){ $(window).scroll(function(){ if ($(this).scrolltop() > 725) { $('#nav-principale').fadein(500); } else { $('#nav-principale').fadeout(500); } }); }); })(jquery); </script>
and worked. now, i'm looking way make navbar, fixed @ top of screen, disappear, if it's possible, after specific number of pixels.
it might easy, have no knowledge in javascript/jquery.
thanks help, zhyrmar
try jquery:
<script type="text/javascript"> $(document).ready(function() { $(window).scroll(function(){ if (($(this).scrolltop() > 725) && ($(this).scrolltop() < 1025)) { $('#nav-principale').fadein(500); } else { $('#nav-principale').fadeout(500); } }); }); </script>
it fade in whenever scrolled between 725 px , 1025 px, otherwise fades out.
also note don't need both (function($)
{ , $(document).ready(function(){
. it's both waiting document load.
Comments
Post a Comment