blob: 10f74d4fb09852a4d7c139de70ac2d10da94575e (
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
26
27
28
29
30
31
32
|
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#scroll-container {
overflow: hidden scroll;
width: 300px;
height: 100px;
}
#anchor {
width: 100px;
height: 100px;
background: orange;
margin-bottom: 100px;
}
#target {
width: 100px;
height: 100px;
background: green;
}
</style>
<div id="scroll-container">
<div id="anchor">anchor</div>
</div>
<div id="target">target</div>
<script>
const scroller = document.getElementById('scroll-container');
scroller.scrollTop = 0;
</script>
|