I have to scroll bottom container which has only max-height defined. I try use scrollTop = scrollHeight but it does't work for me ?
Please advice
My container (HTML/JSX):
<div>
<ListElement />
<ListElement />
<ListElement />
<ListElement />
</div>
CSS
display: flex;
max-height: 400px
Expected result
Container always scrolled to bottom when the component appear.
Similar solution
container.scrollTop = contentHeight - containerHeight;
but above solution working fine only with defined height not max-height ;/
尝试container.scrollTo(0, container.scrollHeight)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.