-
Notifications
You must be signed in to change notification settings - Fork 5
/
scroll.html
57 lines (51 loc) · 1.68 KB
/
scroll.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
font-size: 38px;
line-height: 2.7;
text-align: center;
margin: 0px;
}
.toolbar {
display: flex;
justify-content:space-around
}
.main {
height: 400px;
overflow: auto;
background-color: #364174;
color: #fff;
/* scroll-behavior: smooth; */
}
</style>
<script>
function test() {
// const main = document.querySelector('.main');
// main.scrollTop = 2317;
const a40 = document.querySelector('#a40');
a40.scrollIntoView({
behavior: 'smooth'
});
}
</script>
</head>
<body>
<div class="toolbar">
<a href="#a00">00</a>
<a href="#a20">20</a>
<a href="#a40">40</a>
<button onclick="test()">test</button>
</div>
<div class="main">
<a id="a00"></a>00<br/>01<br/>02<br/>03<br/>04<br/>05<br/>06<br/>07<br/>08<br/>09<br/>10<br/>11<br/>12<br/>13<br/>14<br/>15<br/>16<br/>17<br/>18<br/>19<br/>
<a id="a20"></a>20<br/>21<br/>22<br/>23<br/>24<br/>25<br/>26<br/>27<br/>28<br/>29<br/>30<br/>31<br/>32<br/>33<br/>34<br/>35<br/>36<br/>37<br/>38<br/>39<br/>
<a id="a40"></a>40<br/>41<br/>42<br/>43<br/>44<br/>45<br/>46<br/>47<br/>48<br/>49<br/>50<br/>51<br/>52<br/>53<br/>54<br/>55<br/>56<br/>57<br/>58<br/>59<br/>
</div>
</body>
</html>