I have a website that has a sticky footer at the bottom, and I also have a horizontal navigation bar that sites on top of the footer when you are scrolled to the bottom of the page.
I implemented lazy loading of posts on my site, and now, every time a new post loads, the footer jumps back down to the bottom of the page, but my horizontal navigation menu does not, until the moment I scroll.
I tried doing a setTimeout around the resize function, but that didn't do the trick (but, I may have done that wrong).
When at the complete bottom of the page, the bottom nav and footer look great. I just need it to trigger the replacement of the horizontal navigation menu to the bottom of the screen while loading new posts, then, when at the complete bottom of the screen, have the horizontal navigation menu sit on top of the footer, which is currently is doing.
Here is the JS controlling the placement of the nav menu (#sticky-bottom):
var menuResize = function() {
$j(window).scroll(function() {
if($j(window).scrollTop() + $j(window).height() > $j(document).height() - 140) {
$j('#sticky-bottom').css("bottom", "90px");
}else{
$j('#sticky-bottom').css("bottom", "14px");
}
});
};
$j(window).resize(menuResize).ready(menuResize);
And, here is the CSS for the nav menu:
#sticky-bottom{
position: fixed;
bottom: 14px;
left: 0;
right: 0;
height: 68px;
}
Any help is greatly appreciated! thanks!