Skip to content

Instantly share code, notes, and snippets.

@hmbashar
Created September 20, 2019 08:32
Show Gist options
  • Save hmbashar/ce4e1b4aaaa02c05345ab43eefadb371 to your computer and use it in GitHub Desktop.
Save hmbashar/ce4e1b4aaaa02c05345ab43eefadb371 to your computer and use it in GitHub Desktop.
sticky header secton or menu/ header section position fixed after scrolling
$(window).scroll(function() {
var windowSize = $(window).width();
var kotoDur = $(window).scrollTop();
var menurParHoisi = $(".header-section").scrollTop();
if (kotoDur > menurParHoisi && windowSize > 767) {
$('.header-section').addClass('header-position-fixed');
}else{
$('.header-section').removeClass('header-position-fixed');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment