A section that fades and settles into place as it scrolls into view.
<main class="cap-page">
<h1>Annual report</h1>
<p style="block-size: 30rem">Scroll down.</p>
<section class="cap-reveal" id="rv-one">
<h2>Twelve sites</h2>
<p>The survey covered twelve sites along the creek.</p>
</section>
<div class="cap-reveal-stack" id="rv-stack">
<h2>Four new members</h2>
<p>Alex Rivera, Sam Lee, Jordan Park and one more joined.</p>
<p><a href="#rv-one">Back to the sites</a></p>
</div>
<section class="cap-reveal" data-from="above">
<h2>Next season</h2>
<p>Three sites upstream.</p>
</section>
<p style="block-size: 30rem"></p>
</main>
Installation
// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/reveal.css";
Usage
<section class="cap-reveal">…</section>
<div class="cap-reveal-stack"><p>…</p><h2>…</h2><p>…</p></div>
API reference
CSS variables
| Variable | Default |
|---|
--reveal-distance | -1.5rem |
|---|
Parts and data attributes
| Class | Is |
|---|
.cap-reveal | the root |
|---|
.cap-reveal-stack | a part |
|---|
| Attribute | Values |
|---|
data-from | above |
|---|
Accessibility
Nothing to reach. A revealed section's links and buttons are focusable at every moment, faded or not.