我必须逐页滚动,顶部菜单横幅总是位于屏幕的顶部。单页滚动:如何将横幅保持在顶部
这里是my fiddle
$("section").onepage_scroll({
sectionContainer: "article",
loop: false
});
html, body {
height: 100%;
padding: 0; margin: 0; }
header {
height: 50px;
position: absolute;
top: 0; left: 0; z-index: 100;
background: yellow; opacity: .5;
width: 100%; }
section {
background: beige;
box-sizing: border-box;
height: 100%; width: 100%; }
article {
position: absolute;
display: table-row;
background: brown;
height: 100%; width: 100%; }
article > div {
float: left;
width: 50%;
height: 100%;
border: 1px solid blue;
box-sizing: border-box;
display: table;
text-align: center; }
article > div div {
display: table-cell;
vertical-align: middle; }
article > div:first-of-type { background: red; }
article > div:last-of-type { background: lightgreen; }
<link href="http://www.thepetedesign.com/demos/onepage-scroll.css" rel="stylesheet"/>
<script src="http://www.thepetedesign.com/demos/jquery.onepage-scroll.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<header>this is the top banner</header>
<section>
<article>
<div>
<div>1 this is the first cell</div>
</div>
<div>
<div>this is the second</div>
</div>
</article>
<article>
<div>
<div>2 this is the first cell</div>
</div>
<div>
<div>this is the second</div>
</div>
</article>
<article>
<div>
<div>3 this is the first cell</div>
</div>
<div>
<div>this is the second</div>
</div>
</article>
</section>
我需要显示的剩余空间满格了旗帜。细胞不应该溢出到底部(我应该看到底部的蓝色边框)
PS。
设置边距的部分滚动时给出了这样的结果:
说不好,因为我需要看到完整的“细胞”,直到页面底部.. 。
我需要的结果是这样的:
BUT将单元格完全放在页面中(图片中单元格的底部溢出页面底部 - e没有看到底部的蓝色边框)!
我不确定我是否完全理解,但是如果您将50px(顶部横幅的高度)的边距顶部添加到节(onepage-wrapper),它将从顶部开始50px .. – Goombah
你的意思是你想让第一个单元格和第二个单元格不与横幅重叠? – tofarr
你的描述很糟糕...但如果我理解正确的标题,尝试更改标题{position:fixed;},not position:absolute; – Petroff