Sticky elements that stop at a certain distance from the bottom. Good for sticky items that should sit on top of the footer when it is in view.
.sticky.stuck {
position:fixed!important;
bottom:60px!important;
}
footer {
height:60px;
}
jQuery(document).on("scroll",function(){
if(jQuery(window).scrollTop() + $(window).height() > $(document).height() - 60){
jQuery("div.sticky").addClass("stuck");
} else{
jQuery("div.sticky").removeClass("stuck");
}
});