为固定定位容器启用滚动条

Enable scrollbar for a fixed positionated container

我有一个固定位置的边栏,其中包含一些链接:

<nav id="fixedNav">
    <div class="anchors">
        <ul>
          <li><a href="#">test 1</a></li>
          <li><a href="#">test 2</a></li>
          <li><a href="#">test 3</a></li>
          <li><a href="#">test 4</a></li>
          <li><a href="#">test 5</a></li>
          <li><a href="#">test 6</a></li>
          <li><a href="#">test 7</a></li>
          <li><a href="#">test 8</a></li>
          <li><a href="#">test 9</a></li>
        </ul>
     </div>
     <div class="button"></div>
</nav>

#fixedNav {
    position: fixed;
    left: 0;
    top: 70%;
    z-index: 1000;
}
#fixedNav div {
    float: left;
}
#fixedNav .anchors {
    padding: 1em 1em;
    border: 1px solid #ddd;
    border-left: 0;
    overflow-y: scroll;
}
#fixedNav .button {
    width: 50px;
    height: 50px;
    border: 1px solid #ddd;
    border-left: 0;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

https://jsfiddle.net/850bfnb1/

现在我想添加一个滚动条,因为不是所有的链接都是可见的,因为这个侧边栏的位置,但它不起作用。滚动条出现但没有效果:(

尝试添加

height: 100%;

#fixedNav .anchors - 现在 Anchors 正在填充它的父元素。

bottom: 0;

#fixedNav - 现在你确定你的fixedNav在屏幕底部。然后添加

#fixedNav {
    position: fixed;
    left: 0;
    top: 70%;
    bottom:0;
    z-index: 1000;
}
#fixedNav .anchors {
    padding: 1em 1em;
    border: 1px solid #ddd;
    border-left: 0;
    overflow-y: scroll;
    height: 100%;
}

https://jsfiddle.net/850bfnb1/5/