-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.css
99 lines (79 loc) · 1.55 KB
/
index.css
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
:root {
--wrap: max(2rem, (100vw - 48rem) / 2);
}
/* reset */
*,
::before,
::after {
box-sizing: border-box;
}
body {
margin: 0;
overflow-x: hidden;
}
/* base */
[data-flexscroll] {
--show: 3;
--gap: 1rem;
--size: calc((100% / var(--show)) - ((var(--gap) * (var(--show) - 1)) / var(--show)));
}
[data-flexscroll-viewport] {
--flexscroll-loop: true;
--flexscroll-move: one;
display: flex;
position: relative;
gap: var(--gap);
overflow: auto;
scroll-behavior: smooth;
scroll-snap-type: both mandatory;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
> * {
flex: 0 0 var(--size);
scroll-snap-align: center;
scroll-snap-stop: always;
}
}
/* custom */
[data-flexscroll] {
margin-block: 2rem;
text-align: center;
}
[data-flexscroll-frame] {
margin-bottom: 1rem;
}
[data-flexscroll-viewport] {
height: 12rem;
margin-bottom: 1rem;
padding-inline: var(--wrap);
scroll-padding-inline: var(--wrap);
> * {
display: grid;
place-items: center;
background: gray;
&[inert] {
opacity: 0.5;
}
}
}
[data-flexscroll="column"] [data-flexscroll-viewport] {
flex-direction: column;
padding-block: 2rem;
scroll-padding-block: 2rem;
}
[data-flexscroll-frame] {
margin-inline: var(--wrap);
}
[data-flexscroll-frame] [data-flexscroll-viewport] {
margin-inline: calc(var(--wrap) * -1);
padding-inline: var(--wrap);
scroll-padding-inline: var(--wrap);
}
[data-flexscroll-goto] {
background: yellow;
&[data-flexscroll-goto="inert"] {
background: none;
}
}