-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscroll-snapping.html
More file actions
81 lines (70 loc) · 2.29 KB
/
scroll-snapping.html
File metadata and controls
81 lines (70 loc) · 2.29 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" />
<title>Snap to Scroll</title>
<style>
body {
width: 100vw;
height: 100vh;
margin: 0;
}
.container {
/* scroll-snap-type: y mandatory; */
/* scroll-snap-type: y proximity; */
scroll-snap-type: x mandatory;
overflow-y: scroll;
}
section {
/* width: 100vw; */
height: 100vh;
scroll-snap-align: start;
scroll-margin-left: 100px;
}
section:nth-of-type(1) {
background-color: black;
color: green;
}
section:nth-of-type(2) {
background-color: rgba(0, 0, 0, 0.788);
color: blue;
}
section:nth-of-type(3) {
background-color: rgba(0, 0, 0, 0.571);
color: yellow;
}
section:nth-of-type(4) {
background-color: rgba(20, 20, 20, 0.422);
color: red;
}
h1,
h2 {
font-size: 15em;
}
</style>
</head>
<body class="bg-danger">
<div class="container bg-success">
<section class="d-flex align-items-center justify-content-center">
<h1>Page One</h1>
</section>
<section class="d-flex align-items-center justify-content-center">
<h2>Page Two</h2>
</section>
<section class="d-flex align-items-center justify-content-center">
<h2>Page Three</h2>
</section>
<section class="d-flex align-items-center justify-content-center">
<h2>Page Four</h2>
</section>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous">
</script>
</body>
</html>