Created
December 22, 2014 16:32
-
-
Save arvindang/fce936a0bff1bd29396f to your computer and use it in GitHub Desktop.
Sticky header using waypoint plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#opening, #film, #practical, #conference, #guide') | |
.waypoint(function(direction) { | |
// sticky header | |
$(this).find('> div > header').toggleClass('sticky', direction === 'down'); | |
// nav .current | |
currentNav($(this).attr('id'), direction === 'down'); | |
}) | |
.waypoint(function(direction) { | |
// nav .current | |
currentNav($(this).attr('id'), direction === 'up'); | |
}, { | |
offset: function() { | |
return - $(this).outerHeight(); | |
} | |
}) | |
.waypoint(function(direction) { | |
// sticky header | |
$(this).find('> div > header').toggleClass('sticky-bottom', direction === 'down'); | |
}, { | |
offset: function() { | |
return - $(this).outerHeight() + $(this).find('> div > header').outerHeight(); | |
} | |
}); | |
$('body > header + section').waypoint(function(direction) { | |
$nav.toggleClass('wide', direction === 'down'); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As seen here: http://2013.buildconf.com