我正在尝试实现一个固定侧边栏,其中单击Load More按钮时会动态加载项目。
我将一个类附加fixed到父侧边栏 div 和innerscroll内部 div 以使其可滚动。
.fixed{position:fixed;top:0; bottom:0}
.innerscroll{overflow-y:scroll;height:100%}
Run Code Online (Sandbox Code Playgroud)
侧边栏代码
<div id="sidebar" class="sticky">
<div class="cat-select"><select>
...
</select></div>
<div class="item">
<section id="ajax-load-more">
... ajax content...
</section>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
无法弄清楚为什么在加载下一组帖子后我无法滚动到末尾以使加载更多按钮可见。
好,我知道了。只需在类中添加两行.fixed:
.fixed {
position: fixed;
top: 0;
bottom: 45px; /* added */
min-height: 0 !important; /* added */
}
Run Code Online (Sandbox Code Playgroud)
这将完全按照您的预期工作。祝你好运!