blob: 8ed60934cafe3970b4bd8e5ddcbc79818b10679b (
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
33
34
35
36
37
|
<!DOCTYPE html>
<html>
<title>View transitions: use snapshot containing block for static position (ref)</title>
<link rel="help" href="https://github.com/WICG/view-transitions">
<link rel="author" href="mailto:bokan@chromium.org">
<style>
body {
height: 400vh;
background-color: limegreen;
}
div {
position: absolute;
left: 200px;
top: 600px;
width: 100px;
height: 100px;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
background: darkseagreen;
}
</style>
<div id="target">TARGET</div>
<script>
onload = () => {
const scrollTargetY = document.getElementById('target').offsetTop - 100;
window.scrollTo(0, scrollTargetY);
};
</script>
|