1

我有一个固定的 div 并希望将其保持固定,以便在滚动其父级时保持原样,但是当父级的滚动完成并且正文滚动开始时,“有问题的容器”应该开始滚动。

就像是

<div id="fixedContainer">container in question</div>

#fixedContainer
{
background-color:#ddd;
position: fixed;
width: 200px;
height: 100px;
left: 50%;
top: 0%;
margin-left: -100px; /*half the width*/
}

接着

<div style="height:300px;background-color:#bbb;overflow:scroll;">soeme div</div>

我在这里做了一个样本 http://jsfiddle.net/tDpJB/

在此先感谢您的帮助。-拉维。

4

1 回答 1

0

将元素绝对定位在滚动容器上方而不是尝试将其固定在内部不是更好的主意吗?这会模仿您正在寻找的效果吗?

于 2013-02-26T18:23:44.573 回答