blob: 7c0b381999d303dcefd8dccbdcad60d9c4b1d29d (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<!DOCTYPE html>
<html class="reftest-wait">
<title>Tests position fallback change on scroll with anchor and anchored under the same scroll container</title>
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#scroll">
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#fallback">
<link rel="match" href="anchor-scroll-position-try-012-ref.html">
<style>
#scroller {
position: relative;
width: 400px;
height: 400px;
overflow-y: scroll;
}
.box {
min-height: 100px;
width: 100px;
}
#anchor {
anchor-name: --a;
background: orange;
}
#anchored {
position: absolute;
top: anchor(--a bottom);
width: 100px;
height: 100px;
background: green;
position-anchor: --a;
position-try-options: --pf;
}
@position-try --pf {
top: auto;
bottom: anchor(--a top);
}
</style>
<div id="scroller">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box" id="anchor"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div id="anchored"></div>
</div>
<script>
requestAnimationFrame(() => {
requestAnimationFrame(() => {
scroller.scrollTop = 150;
document.documentElement.classList.remove('reftest-wait');
});
});
</script>
</html>
|