Created
September 20, 2019 08:32
-
-
Save hmbashar/ce4e1b4aaaa02c05345ab43eefadb371 to your computer and use it in GitHub Desktop.
sticky header secton or menu/ header section position fixed after scrolling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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