查看原文
方法1
function updateScroll(){
var element = document.getElementById("divId");
element.scrollTop = element.scrollHeight;
}
<div class="container">
<div class="inner">Bottom</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Hi</div>
<div class="inner">Top</div>
</div>
<style>
.container {
height: 100px;
overflow: auto;
display: flex;
flex-direction: column-reverse;
}
</style>