blob: 135763bf6bb8d705810247b3e6ac6b85e0d54b38 (
plain)
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
|
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#scroll-container {
overflow: hidden scroll;
width: 300px;
height: 100px;
}
#target {
width: 100px;
height: 100px;
margin-top: 100px;
background: green;
}
</style>
<div id="scroll-container">
<div id="target">target</div>
</div>
<script>
const scroller = document.getElementById('scroll-container');
scroller.scrollTop = 100;
</script>
|