[英]How to scroll bottom container which has max-height defined?
我必须滚动仅定义了max-height的底部容器。 我尝试使用scrollTop = scrollHeight但对我不起作用?
请指教
我的容器(HTML / JSX):
<div>
<ListElement />
<ListElement />
<ListElement />
<ListElement />
</div>
的CSS
display: flex;
max-height: 400px
预期结果
出现组件时,容器始终滚动到底部。
类似的解决方案
container.scrollTop = contentHeight - containerHeight;
但以上解决方案只能在定义的高度上不能正常工作max-height; /
尝试container.scrollTo(0, container.scrollHeight)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.