Skip to content

Instantly share code, notes, and snippets.

@keks55
Last active June 19, 2017 13:02
Show Gist options
  • Save keks55/bbc29803bfe7fe6d7a44fc19de265262 to your computer and use it in GitHub Desktop.
Save keks55/bbc29803bfe7fe6d7a44fc19de265262 to your computer and use it in GitHub Desktop.
$(window).scroll(function() {
var sticky = $('.header,.header-wrap'),
scroll = $(window).scrollTop();
(scroll >= 100 ) ? sticky.addClass('fixed') : sticky.removeClass('fixed');
});
/*css*/
.fixed{
position:fixed;
background: #BEEB9F;
/*width: 1024px;*/
width: 100%;
z-index: 1001;
left: 0;
right: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment