Skip to content

Instantly share code, notes, and snippets.

@gugote
Last active August 29, 2015 13:56
Show Gist options
  • Save gugote/9229785 to your computer and use it in GitHub Desktop.
Save gugote/9229785 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
// get basic measures
$wwidth = $(window).width();
$wheight = $(window).height();
// based on scroll, toggle header
$(window).scroll(function() {
var y = $(window).scrollTop();
if (y > $wheight+($wheight/2)) {
$('header').fadeIn('slow');
} else if (y <= $wheight+($wheight/2)) {
$('header').fadeOut('slow');
}
});
});
@gugote
Copy link
Author

gugote commented Apr 17, 2014

Useful when you have a full height first section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment