Skip to content

Commit 70d1116

Browse files
committed
[DOC] Ajout exemple carrousel
1 parent c150588 commit 70d1116

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

content/slider.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: Carrousel
3+
description: Utilisation du callback anchor pour réaliser un carrousel
4+
layout: libdoc/page-split
5+
category: Exemples
6+
order: 20
7+
---
8+
9+
```html
10+
<ul>
11+
<li id="foo1" c-scrollspy="anchor">1</li>
12+
<li id="foo2" c-scrollspy="anchor">2</li>
13+
<li id="foo3" c-scrollspy="anchor">3</li>
14+
<li id="foo4" c-scrollspy="anchor">4</li>
15+
<li id="foo5" c-scrollspy="anchor">5</li>
16+
<li id="foo6" c-scrollspy="anchor">6</li>
17+
</ul>
18+
<nav>
19+
<a href="#foo1">1</a>
20+
<a href="#foo2">2</a>
21+
<a href="#foo3">3</a>
22+
<a href="#foo4">4</a>
23+
<a href="#foo5">5</a>
24+
<a href="#foo6">6</a>
25+
</nav>
26+
27+
<!-- DEMO ONLY -->
28+
<style>
29+
body {
30+
padding: var(--ita-spacing-4);
31+
color: var(--ita-color-primary-800);
32+
font-family: var(--ita-font-family-mono);
33+
font-size: 1rem;
34+
line-height: 1.5rem;
35+
padding-bottom: 150vh;
36+
}
37+
nav {
38+
text-align: center
39+
}
40+
ul {
41+
list-style: none;
42+
padding: 1em;
43+
margin: 0 auto;
44+
display: flex;
45+
gap: 1em;
46+
width: 100%;
47+
overflow: auto;
48+
scroll-snap-type: x mandatory;
49+
scroll-behavior: smooth;
50+
box-sizing: border-box;
51+
border: 2px solid var(--ita-color-primary-500);
52+
background-color: var(--ita-color-primary-100);
53+
}
54+
li {
55+
aspect-ratio: 2;
56+
min-width: 80%;
57+
max-width: 80%;
58+
scroll-snap-align: start;
59+
display: flex;
60+
align-items: center;
61+
justify-content: center;
62+
scroll-margin-top: 100vh;
63+
scroll-margin-left: 1em;
64+
border: 2px solid var(--ita-color-primary-500);
65+
background-color: var(--ita-color-primary-200);
66+
}
67+
a {
68+
color: var(--ita-color-primary-700);
69+
text-decoration: none;
70+
}
71+
a.active {
72+
opacity: 0.3;
73+
}
74+
</style>
75+
```
76+
{:.playground title="Exemple avec un carrousel"}

0 commit comments

Comments
 (0)