Last active
March 26, 2016 08:31
-
-
Save davist11/9621117 to your computer and use it in GitHub Desktop.
This file contains 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
var $body = $('body'); | |
if (!$body.hasClass('whatever')) { | |
var header_wrap = $('#header-wrap'); | |
var sticky_navigation_offset_top = header_wrap.offset().top; | |
var sticky_navigation = function() { | |
var scroll_top = $(window).scrollTop(); | |
if (scroll_top > sticky_navigation_offset_top) { | |
header_wrap.addClass('sticky-nav'); | |
$body.addClass('scrolled'); | |
} | |
else { | |
header_wrap.removeClass('sticky-nav'); | |
$body.removeClass('scrolled'); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment