내가 노력하는 스크롤로의 특정 테이블의 행다; div
와 함께 table
그 안에,모두가 overflow:auto
. 이것은 나의 코드 스크롤을 특정의 인덱스 테이블:
var table1 = document.getElementById("old_table");
table1.rows[3].scrollIntoView({
behavior: 'smooth',
block: 'center'
});
이것은 내 html:
<div id="old_slab"><table id="old_table" border="2"></table></div>
내 css:
#old_slab{
position: absolute;
top:34em;
left:30em;
width:40em;
height: 15em;
overflow: auto;
}
#old_table{
height: 15em;
overflow: auto;
width: 40em;
}
행 내에서 테이블은 동적으로 만들어진,그러므로 그들은 하드에서 내 html 코드입니다. 그럼에도 불구하고,테이블이 비어있지 않음. 어떤 이유로, scrollIntoView()
작동 하지 않으며 이유는 모르겠. 도와 주시기 바랍니다.
편집: 이상하게 때를 제거 behaviour
고 block
인수를,그것은 작품:
table1.rows[3].scrollIntoView(true);