fix: meilleurs exemples
This commit is contained in:
parent
b4aeb770da
commit
723cad2f1c
1 changed files with 30 additions and 40 deletions
70
index.html
70
index.html
|
@ -135,68 +135,58 @@
|
|||
</table>
|
||||
<div class="accordion">
|
||||
<details name="reqs">
|
||||
<summary>Graduation Requirements</summary>
|
||||
<p class="tab-content">
|
||||
Requires 40 credits, including a passing grade in health, geography,
|
||||
history, economics, and wood shop.
|
||||
<summary>Test 1</summary>
|
||||
<p>
|
||||
Blablablabla bla bla bla bla
|
||||
</p>
|
||||
</details>
|
||||
<details name="reqs">
|
||||
<summary>System Requirements</summary>
|
||||
<p class="tab-content">
|
||||
Requires a computer running an operating system. The computer must have some
|
||||
memory and ideally some kind of long-term storage. An input device as well
|
||||
as some form of output device is recommended.
|
||||
<summary>Test 2</summary>
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur <a href="#">adipiscing</a> elit, sed do. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do.
|
||||
</p>
|
||||
</details>
|
||||
<details name="reqs">
|
||||
<summary>Job Requirements</summary>
|
||||
<p class="tab-content">
|
||||
Requires knowledge of HTML, CSS, JavaScript, accessibility, web performance,
|
||||
privacy, security, and internationalization, as well as a dislike of
|
||||
broccoli.
|
||||
<summary>Test 3</summary>
|
||||
<p>
|
||||
Insérer ici script de bee-movie
|
||||
</p>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<div class="tabs">
|
||||
<details open name="tabs"> <!-- default first "tab" to open -->
|
||||
<summary>Tag</summary>
|
||||
<details open name="tabs">
|
||||
<summary>Tab 1</summary>
|
||||
<div class="content">
|
||||
<p>Imagine an <strong>accordion-like element</strong> with <strong>native keyboard support</strong> that doesn't require javascript for control.</p>
|
||||
<p>Enter the details tag.</p>
|
||||
<p>Ceci est un test d'onglet voir s'ils marchent.</p>
|
||||
<details>
|
||||
<summary>The details tag</summary>
|
||||
<p>This is a details tag with content</p>
|
||||
<summary>Details dans le tab</summary>
|
||||
<p>Test test test test test test test test test test test test test test test test test test test test</p>
|
||||
</details>
|
||||
<p>The details tag gives us a simple accordion with no scripts—that's great! But it feels like it could be something more...imagine if it could do tabs.</p>
|
||||
<p>Code basé sur ce codepen : <a href="https://codepen.io/RYJASM/pen/eYoYeRg">Cliquez ici</a></p>
|
||||
</div>
|
||||
</details>
|
||||
<details name="tabs">
|
||||
<summary>Tabs ?</summary>
|
||||
<summary>Tab 2</summary>
|
||||
<div class="content">
|
||||
<p>Tabs and accordions work in technically the same way, although tabs typically require a shared parent container and containers to build out the tabs and content separate from each other.</p>
|
||||
<p>Interactivity is another difference: the ways accordions or tabs are toggled. With accordions it's common to be able to open and close them individually, but with tabs there must always be one, and only one, open.</p>
|
||||
<p>At first glance there doesn't seem to be a way to make this work. The structure isn't right. The layout isn't right. The functionality isn't quite right. But each of those problems can be solved if we look a bit closer.</p>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc omni virtuti vitium contrario nomine opponitur. Falli igitur possumus. Res enim concurrent contrariae. Primum quid tu dicis breve? Bork Quis est tam dissimile homini. </p>
|
||||
<p>Duo Reges: constructio interrete. At eum nihili facit; Quorum sine causa fieri nihil putandum est. Cur iustitia laudatur? Ergo, si semel tristior effectus est, hilara vita amissa est? Immo alio genere; </p>
|
||||
<blockquote cite='http://loripsum.net'>
|
||||
Ex quo intellegi debet homini id esse in bonis ultimum, secundum naturam vivere, quod ita interpretemur: vivere ex hominis natura undique perfecta et nihil requirente.
|
||||
</blockquote>
|
||||
<p>Sed fac ista esse non inportuna; Quae ista amicitia est? Invidiosum nomen est, infame, suspectum. Quid ergo? Graece donan, Latine voluptatem vocant. Sed ne, dum huic obsequor, vobis molestus sim. </p>
|
||||
<p>Nescio quo modo praetervolavit oratio. Beatus sibi videtur esse moriens. Vide, quantum, inquam, fallare, Torquate. </p>
|
||||
</div>
|
||||
</details>
|
||||
<details name="tabs">
|
||||
<summary>CSS</summary>
|
||||
<summary>Tab 3</summary>
|
||||
<div class="content">
|
||||
<p>With a little help from the <strong>display: contents;</strong> property, we can transform a group of discrete details tags with tab and content area elements as children, into a group of the tab and content area elements from all the details elements mixed together.</p>
|
||||
<p>Say you had 3 small buckets of red and blue balls. The buckets can interact with each other or bang together, but the balls inside each bucket can't interact with the balls from the other buckets.</p>
|
||||
<p>You could think of what we are doing like pouring all of the small buckets into a larger bucket. Now all of the balls can interact with each other and we can organize them by color in the bigger bucket. With display: contents; it's as if the details tag isn't there at all—at least visually.</p>
|
||||
<p>Now that all the tab and content area elements can interact with each other in the flow of the page, we can use <strong>display: flex;</strong> and <strong>order</strong> to make the tabs flow nicely but also be separate from the content area.</p>
|
||||
<p>And that's what you see here! Open up the inspector and have a look.</p>
|
||||
</div>
|
||||
</details>
|
||||
<details name="tabs">
|
||||
<summary>Javascript</summary>
|
||||
<div class="content">
|
||||
<p>So you might have thought we could get by without any JS, but we need it a little. Luckily it's the type of script that you can write once and reuse without reconfiguration.</p>
|
||||
<p>The default functionality of the details tab means that it can be toggled open or closed. That's not what we want for tabs. Each details tag must be manually closed and then another opened. We want a tab to stay open and then close when another is picked.</p>
|
||||
<p>By watching for attribute changes and blocking keyboard and mouse input from toggling a details tab when a tab is open, we can emulate the expected tab behavior.</p>
|
||||
<p>Then it's just a matter of toggling the sibling details tags when another is selected.</p>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Tu vero, inquam, ducas licet, si sequetur; Expectoque quid ad id, quod quaerebam, respondeas. Quare attende, quaeso. Cui Tubuli nomen odio non est? Sedulo, inquam, faciam. </p>
|
||||
<p>Conferam tecum, quam cuique verso rem subicias; Ego vero volo in virtute vim esse quam maximam; Sed ego in hoc resisto; Tamen a proposito, inquam, aberramus. </p>
|
||||
<p>Occultum facinus esse potuerit, gaudebit; Verum hoc idem saepe faciamus. Piso igitur hoc modo, vir optimus tuique, ut scis, amantissimus. Itaque ad tempus ad Pisonem omnes. Apparet statim, quae sint officia, quae actiones. Quodsi ipsam honestatem undique pertectam atque absolutam. </p>
|
||||
<p>Duo Reges: constructio interrete. Animum autem reliquis rebus ita perfecit, ut corpus; Aliter enim explicari, quod quaeritur, non potest. Quid autem habent admirationis, cum prope accesseris? Negare non possum. Quid censes in Latino fore? </p>
|
||||
<p>Non laboro, inquit, de nomine. Memini vero, inquam; Hunc vos beatum; Optime, inquam. </p>
|
||||
<p>Restinguet citius, si ardentem acceperit. Cyrenaici quidem non recusant; Tecum optime, deinde etiam cum mediocri amico. Cave putes quicquam esse verius. Igitur neque stultorum quisquam beatus neque sapientium non beatus. Non semper, inquam; Gerendus est mos, modo recte sentiat. </p>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue