Skip to content

Instantly share code, notes, and snippets.

@giiska
Created January 26, 2015 02:26
Show Gist options
  • Save giiska/cf202d37c6e1cf2a9394 to your computer and use it in GitHub Desktop.
Save giiska/cf202d37c6e1cf2a9394 to your computer and use it in GitHub Desktop.
scroll interactive position fixed header 响应 scroll 高度的固定浮动栏
_bottomHeader();
$(window).on('scroll', function() {
if ($(this).scrollTop() <= obj.sliderHeight) {
_bottomHeader();
} else {
_topHeader();
}
});
return obj;
function _bottomHeader() {
obj.$header.css({
'position': 'absolute',
'top': obj.sliderHeight
});
}
function _topHeader() {
obj.$header.css({
'position': 'fixed',
'top': 0
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment