Show div after scrolling 100px from the top of the page

后端 未结 3 640
广开言路
广开言路 2020-12-14 19:41

I found this, but this does it 100px before the bottom of the page. I need it 100px from the top of the page. I know how to implement it, I\'ve done other jquery animations,

3条回答
  •  轮回少年
    2020-12-14 20:14

    Try this:

    var menu = $("nav");
    $(window).scroll(function(){
      //more then or equals to
      if($(window).scrollTop() >= 100 ){
           menu.show();
    
      //less then 100px from top
      } else {
         menu.hide();
    
      }
    });
    

提交回复
热议问题