forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscroll-snap-programmatic-overflow-scroll.html
55 lines (50 loc) · 1.19 KB
/
scroll-snap-programmatic-overflow-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
<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html, body {
overflow: hidden;
padding: 0;
margin: 0;
}
#container {
width: 100%;
height: 400px;
overflow-y: auto;
position: absolute;
-webkit-overflow-scrolling: touch;
scroll-snap-type: y mandatory;
}
.child {
width: 100%;
height: 100%;
scroll-snap-align: start;
}
#fixed {
position: fixed;
top: 0;
right: 0;
width: 1em;
height: 1em;
background-color: white;
}
#output {
margin-top: 400px;
}
</style>
</head>
<div id="container">
<div class="child" style="background-color: red"></div>
<div class="child" style="background-color: green"></div>
<div class="child" style="background-color: blue"></div>
</div>
<div id="fixed"></div>
<script>
if (window.testRunner)
testRunner.dumpAsText();
container.scrollTop = 400;
fixed.remove();
document.write(`container.scrollTop is now: ${container.scrollTop}`);
</script>
</html>