Skip to content

Instantly share code, notes, and snippets.

@shabaz-ejaz
Created September 7, 2017 15:46
Show Gist options
  • Select an option

  • Save shabaz-ejaz/17b0c7b5c734917acd9ac6d7f93c1542 to your computer and use it in GitHub Desktop.

Select an option

Save shabaz-ejaz/17b0c7b5c734917acd9ac6d7f93c1542 to your computer and use it in GitHub Desktop.
Sticky header after scroll
var stickyHeaderTop = $('#jetmenu').offset().top;
$(window).scroll(function(){
if( $(window).scrollTop() > stickyHeaderTop ) {
$('#jetmenu').css({position: 'fixed', top: '0px'});
$('#jetmenu').css('display', 'block');
} else {
$('#jetmenu').css({position: 'static', top: '0px'});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment