Skip to content

Commit 0237ec0

Browse files
committed
inertness option added
1 parent 01353a8 commit 0237ec0

File tree

1 file changed

+64
-15
lines changed

1 file changed

+64
-15
lines changed

carousel-configurator/src/components/Configurator.svelte

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@
9090
overflow-x: auto;
9191
overscroll-behavior-x: contain;
9292
scroll-snap-type: x mandatory;
93-
94-
container-type: scroll-state;
9593
anchor-name: --carousel;
9694
9795
> li {
@@ -103,8 +101,6 @@
103101
overflow-x: auto;
104102
overscroll-behavior-x: contain;
105103
scroll-snap-type: x mandatory;
106-
107-
container-type: scroll-state;
108104
anchor-name: --carousel;
109105
110106
columns: 1;
@@ -171,12 +167,54 @@
171167
}
172168
}`}{/if}
173169
</code></pre></div>{/if}
170+
171+
{#if inerted === 'Yes'}
172+
<div>
173+
<p>Inert Interactivity</p>
174+
{#if paged === 'No'}<pre><code>{`.carousel {
175+
> li {
176+
container-type: scroll-state;
177+
178+
> .card {
179+
@container not scroll-state(snapped: x) {
180+
interactivity: inert;
181+
opacity: .25;
182+
}
183+
}
184+
}
185+
}
186+
`}</code></pre>{/if}
187+
{#if paged === 'Yes'}<pre><code>{`.carousel {
188+
&::column {
189+
container-type: scroll-state;
190+
191+
> .card {
192+
@container not scroll-state(snapped: x) {
193+
interactivity: inert;
194+
opacity: .25;
195+
}
196+
}
197+
}
198+
}`}</code></pre>{/if}
199+
</div>
200+
{/if}
174201
</div>
175202

203+
{@html `<style>${`
204+
.with-inert .card {
205+
transition: opacity .5s ease;
206+
207+
@container not scroll-state(snapped: x) {
208+
interactivity: inert;
209+
opacity: .25;
210+
}
211+
}
212+
}`}</style>`}
213+
176214
<style>
177215
.carousel {
178216
/* Scrolling behavior. */
179-
overflow: auto;
217+
overflow-x: auto;
180218
scroll-behavior: smooth;
181219
overscroll-behavior-x: contain;
182220
scrollbar-width: none;
@@ -189,7 +227,6 @@
189227
/* Styles and layout */
190228
padding: var(--size-3);
191229
scroll-padding: var(--size-3);
192-
resize: both;
193230
194231
container-type: inline-size scroll-state;
195232
inline-size: 1024px;
@@ -200,6 +237,7 @@
200237
&.with-pages {
201238
columns: 1;
202239
block-size: 13lh;
240+
resize: both;
203241
text-align: center;
204242
205243
& > li {
@@ -209,6 +247,7 @@
209247
210248
&::column {
211249
scroll-snap-align: center;
250+
container-type: scroll-state;
212251
}
213252
}
214253
@@ -220,10 +259,12 @@
220259
221260
& > li {
222261
scroll-snap-align: center;
262+
container-type: scroll-state;
223263
}
224264
}
225265
226266
& li {
267+
container-type: scroll-state;
227268
padding: 0;
228269
display: inline-grid;
229270
counter-increment: item;
@@ -246,10 +287,6 @@
246287
&:focus {
247288
outline: 2px solid var(--link);
248289
}
249-
250-
/* @container scroll-state(snapped: x) {
251-
outline: 2px solid red;
252-
} */
253290
}
254291
255292
/* Scroll marker pages */
@@ -393,15 +430,27 @@
393430
394431
& > section {
395432
display: grid;
396-
gap: var(--size-2);
433+
gap: var(--size-8);
434+
435+
& > div {
436+
display: grid;
437+
align-items: start;
438+
439+
& > * {
440+
grid-area: 1/1;
441+
}
442+
}
397443
398444
& p {
399-
margin-block-end: var(--size-2);
445+
z-index: 1;
446+
margin-block-start: -.75lh;
447+
margin-inline-start: .5lh;
400448
max-inline-size: max-content;
401-
padding-inline: .75ch;
449+
padding-inline: 1ch;
402450
padding-block: .25ch;
403-
background: var(--surface-2);
404-
border-radius: var(--radius-2);
451+
background: light-dark(white, var(--surface-2));
452+
border-radius: var(--radius-round);
453+
box-shadow: var(--shadow-3);
405454
}
406455
}
407456

0 commit comments

Comments
 (0)