Created
January 26, 2015 02:26
-
-
Save giiska/cf202d37c6e1cf2a9394 to your computer and use it in GitHub Desktop.
scroll interactive position fixed header 响应 scroll 高度的固定浮动栏
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
_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