带有侧边栏的单滚动网页
Single-scroll webpage with sidebar
如何放置以下示例的页面内容-http://jsfiddle.net/cq8dC/在nav
侧边栏的右侧,而不是后面?
更新样式。将样式padding-left: 255px;
添加到.水平
.horizontal
{
display: inline-block;
padding-left: 255px;
vertical-align: top;
white-space: normal;
width: 100%;
}
DEMO
jsFiddle演示
首先,您应该为内容添加一个容器。我把它叫做#Content
。
然后我将这些样式添加到CSS:
body {
overflow: hidden;
}
#Content {
left: 240px;
right: 0;
top: 0;
bottom: 0;
position: fixed;
overflow: scroll;
}
这使得#Content在页面中占据静止位置,并且可以自己滚动。
此外,我还更新了JavaScript
根现在是#Content元素,我使用position()而不是offset()。我这样做是因为position()Get the current coordinates of the first element in the set of matched elements, relative to the offset parent
(来自文档)。
相关文章:
- Don'当到达iFrame底部时,不要滚动网页
- 如何在 django 中加载页面之前自动滚动网页
- 防止空格键和箭头键滚动网页
- 我们可以在不将其加载到无限可滚动网页中的情况下访问 DOM 元素吗?
- 如何在jquery中垂直滚动网页
- 在Chrome中滚动网页时出现奇怪问题
- 带有侧边栏的单滚动网页
- 按子像素滚动网页
- 聚焦SWF对象时停止滚动网页
- 如何在页面加载时向下滚动网页20px-50px
- 滚动网页与鼠标的位置-悬停在侧面元素
- JS代码滚动网页不工作
- 添加Class到body>在用户滚动网页后标记
- 表格,当用户向下/向上滚动网页时显示
- 禁用iPad滚动网页
- 单指滚动网页-什么技术?工作榜样
- 使用iPhone的加速度计滚动网页
- 无法在iPad上滚动网页
- 如何在向下滚动网页时显示内容
- 如何自动滚动网页