Skip to content

Instantly share code, notes, and snippets.

@bueckl
Last active November 28, 2015 19:05
Show Gist options
  • Save bueckl/01a6635275d71f399815 to your computer and use it in GitHub Desktop.
Save bueckl/01a6635275d71f399815 to your computer and use it in GitHub Desktop.
Fadeout on Scroll
$(window).on('scroll', function() {
var header = $("header");
var scrollBottom = $(document).height() - $(this).scrollTop() - $(this).height();
if ($(this).scrollTop() > 350 && scrollBottom > 450 ) {
if (!header.data('faded')) header.data('faded', 1).stop(true).fadeTo(400, 0);
} else if (header.data('faded')) {
header.data('faded', 0).stop(true).fadeTo(400, 1);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment