gpt4 book ai didi

jquery - 我正在使用 Bootstrap 固定标题表,现在我想在渲染到 taht 页面时设置滚动位置

转载 作者:行者123 更新时间:2023-11-28 02:50:24 26 4
gpt4 key购买 nike

固定 header 有以下类

<style>
.table-fixed tbody
{
height: 580px;
display: block;
overflow-y: auto!important;
border: solid 1px #c1c1c1;
position: relative;
/*width: 100%;*/
}

.table-fixed thead, .table-fixed tbody tr
{
display: table;
width: 100%;
table-layout: fixed;

}

.table-fixed thead
{
width: calc(100%-1em);
border: solid 1px #c1c1c1;
}

</style>

现在我想在特定的 anchor 标签上设置滚动条的位置

表格是这样的 部件号abc1
aff-200abc2
abc 2 descabc 3 desc
a1000

最佳答案

<div>
<table id="my_table">
<tr id='row_1'><td>1</td></tr>
<tr id='row_2'><td>2</td></tr>
<tr id='row_3'><td>3</td></tr>
<tr id='row_4'><td>4</td></tr>
<tr id='row_5'><td>5</td></tr>
<tr id='row_6'><td>6</td></tr>
<tr id='row_7'><td>7</td></tr>
<tr id='row_8'><td>8</td></tr>
<tr id='row_9'><td>9</td></tr>
</table>
</div>

var container = $('div'),
scrollTo = $('#row_8');

container.animate({
scrollTop: scrollTo.offset().top - container.offset().top +
container.scrollTop()
});

关于jquery - 我正在使用 Bootstrap 固定标题表,现在我想在渲染到 taht 页面时设置滚动位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46686753/

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