Skip to content

Instantly share code, notes, and snippets.

@pavelbinar
Created November 14, 2013 10:02
Show Gist options
  • Save pavelbinar/7464342 to your computer and use it in GitHub Desktop.
Save pavelbinar/7464342 to your computer and use it in GitHub Desktop.
JavaScript: Fixed top nav after certain distance from top
// Fixed nav after certain point
// Show the fixed-strip after reachinch 240px from the top
$(window).scroll(function () {
if ($(this).scrollTop() > 240) {
$('.fixed-strip').css('visibility', 'visible');
} else {
$('.fixed-strip').css('visibility', 'hidden');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment