gpt4 book ai didi

jquery - 向下滚动 - 反向

转载 作者:行者123 更新时间:2023-11-28 18:28:18 30 4
gpt4 key购买 nike

你好,我有这个 html 代码:

 <style type="text/css">
.container{
width: 450;
height: 400;
border:1px solid;
border-radius: 6px;
background: #000;
}
.name{
border-bottom:1px solid;
background: #FFF;
}
.div_lines{
max-height: 360px;
background: #000;
color:#FFF;
overflow: auto;
vertical-align: top;
}
</style>
<div class="container">
<div class="name">show</div>
<div class="div_lines">
<code class="lines">
<div class="line">1</div>
<div class="line">2</div>
<div class="line">3</div>
<div class="line">4</div>
<div class="line">5</div>
<div class="line">6</div>
<div class="line">7</div>
<div class="line">8</div>
<div class="line">9</div>
<div class="line">10</div>
<div class="line">11</div>
<div class="line">12</div>
<div class="line">13</div>
<div class="line">14</div>
<div class="line">15</div>
<div class="line">16</div>
<div class="line">17</div>
<div class="line">18</div>
<div class="line">19</div>
<div class="line">20</div>
<div class="line">21</div>
<div class="line">22</div>
<div class="line">23</div>
<div class="line">24</div>
<div class="line">25</div>
<div class="line">26</div>
<div class="line">27</div>
<div class="line">28</div>
</code>
</div>
</div>

但我想知道的是,有没有一种方法可以更改向下滚动,这样当我到达将显示滚动条的位置时,我将需要向上滚动以查看过去的数据,而不是向下滚动?就像命令提示符一样,它会显示最后插入的行,您需要向上滚动才能看到预览信息。

最佳答案

让这段 javascript 代码在插入另一行时运行:

var lines=document.getElementsByClassName('line');
lines[lines.length-1].scrollIntoView();

关于jquery - 向下滚动 - 反向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15080164/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com