我的页面底部固定了一个页脚,但我不希望它在用户到达页面底部时可见,然后我希望它向上滑动。当用户滚动页面到页面底部时,页脚向上滑动
页脚高度为200px,固定在底部,身体底部有200px填充。
CSS:
footer {
min-height: 200px;
background-color: #bdf207;
position: fixed;
width: 100%;
left: 0;
right: 0;
bottom: 0;
}
body {
padding-bottom: 200px;
}
我使用的jQuery是如下,但它不工作:
$(window).scroll(function() {
// when user starts scrolling trigger function
var scrollBottom = $(document).height() - $(window).height() - $(window).scrollTop();
// if the bottom of the page reaches 250px remaining of the document
if (scrollBottom > 250){
// slide the footer up
$('footer').slideUp('slow');
}
});