固定标题具有以下类
<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>
现在我想在特定的锚标签上设置滚动条的位置
像这样的表 部分Numberabc1答案 0 :(得分:0)
<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()
});