Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery - Hide element upon scroll

0 votes
14 views
added Dec 18, 2018 in jQuery by LC Marshal Captain (20,510 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 (20,510 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.
...