Skip to content

Instantly share code, notes, and snippets.

@lucprincen
Created October 22, 2013 16:02
Show Gist options
  • Select an option

  • Save lucprincen/7103350 to your computer and use it in GitHub Desktop.

Select an option

Save lucprincen/7103350 to your computer and use it in GitHub Desktop.
//js:
$(window).scroll(function(){
var scrollPos = $(window).scrollTop();
if( scrollPos >= 200 && $(header).hasClass('scrolled') === false ){
$('header').addClass('scrolled')
}
});
//css:
header{
background:#eee;
border: 1px solid #eee; //zelfde als achtergrondkleur, of zetten op 'transparent
}
header.scrolled{
border: 1px solid #000; //whatever
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment