jQuery - Hide element upon scroll

0 votes
322 views
added Dec 18, 2018 in jQuery by LC Marshal Captain (25,790 points)
retagged Dec 18, 2018 by LC Marshal
$(window).scroll(function() { 
  var navbarLivemag = $('#livemag-default .navbar');
  $('#livemag-default .navbar').show();
});

 

1 Response

0 votes
responded Dec 18, 2018 by LC Marshal Captain (25,790 points)
$(window).scroll(function() {
  var navbarLivemag = $('#livemag-default .navbar');
  if ($(this).scrollTop()>0) {
    $(navbarLivemag).fadeIn();
  }
  else {
    $(navbarLivemag).fadeOut(300);
  }
});

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...