Skip to content

Instantly share code, notes, and snippets.

@wemakeweb
Created February 24, 2014 19:42
Show Gist options
  • Save wemakeweb/9195515 to your computer and use it in GitHub Desktop.
Save wemakeweb/9195515 to your computer and use it in GitHub Desktop.
$(function(){
var height, $nav, $win = $(window), klasse, hasClass = false;
/* Config */
/* Scroll Weite in pixelen */
height = 690;
/* Element dem die klasse hinzugefügt wird */
$nav = $('.navbar-inner');
/* class die hinzugefügt wird */
klasse = 'scrolled';
$win.on('scroll', function(){
if( $win.scrollTop() > height && !hasClass ){
hasClass = true;
$nav.addClass(klasse);
} else if( $win.scrollTop() < height && hasClass ){
hasClass = false;
$nav.removeClass(klasse);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment