we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "jquery onscroll sticky header"
Badis
31 Apr 2017
1$(window).scroll(function(){
2  var sticky = $('.sticky'),
3      scroll = $(window).scrollTop();
4
5  if (scroll >= 100) sticky.addClass('fixed');
6  else sticky.removeClass('fixed');
7});