【发布时间】:2014-12-30 19:32:06
【问题描述】:
我一直在疯狂地尝试实现这一点,但我就是想不通(初学者)。
如您所见,当您向下滚动时,顶部头部部分会粘在页面顶部,但也会溢出一点。这是用stickyjs完成的。我也想对头部的底部做同样的事情,在滚动一点让它“下沉”几个像素同时粘在页面底部之后,所以有更多的可见性,但不管我尝试什么,它只是行不通。
如果有人能提供帮助,我将不胜感激。
这是顶部的代码:
#head {
z-index:101;
display: block;
position: absolute;
bottom: 20%;
width:100%;
margin:0 auto;
right:0;
left:0;
height:85px;
background: url(../float.png) #fff 50% 50% no-repeat;
text-indent:-9999px;
overflow:hidden;
}
这是底部的代码:
#footerhead {
z-index:100;
position:fixed;
left:0px;
bottom:0px;
margin:0 auto;
height:20%;
width:100%;
background:url(../footer.png) #fff 50% 0 no-repeat;
}
这是让它粘住的stickyjs:
<script>
$(document).ready(function(){
$("#head").sticky({topSpacing:-70});
});
</script>
请帮帮我。 :(
【问题讨论】:
标签: javascript jquery css twitter-bootstrap sticky-footer