Skip to content

Instantly share code, notes, and snippets.

@andrewjcohen
Created Mar 13, 2014
Embed
What would you like to do?
JQuery to fix the thoughtbot.com header on scroll
$(document).scroll(function() {
if( $(this).scrollTop() > $(window).height() - 90 && !$(mainNav).hasClass('showing') ) {
$(mainNav).addClass('showing');
}
else if ( $(this).scrollTop() < $(window).height() - 90 && $(mainNav).hasClass('showing') ) {
$(mainNav).removeClass('showing');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment