Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collapsible fragments #1744

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,25 @@ The display order of fragments can be controlled using the ```data-fragment-inde
</section>
```

#### Collapsible fragments

You can define a fragment to be collapsible - i.e. it would not take any room when not the active one.
This is useful for showing a progression of fragments when each one relpaces the one before it.

Setting this up by adding ```collapsible``` class to a fragment.
It is recommended to wrap all fragments with a ```div``` that has a ```style=min-height:200px``` (or some other sensible value) to make sure that the slide has preserved room for the fragments.

```html
<section>
<div style="min-height: 70px">
<p class="fragment collapsible">This</p>
<p class="fragment collapsible">This will</p>
<p class="fragment collapsible">This will be</p>
<p class="fragment">This will be revealed.</p>
</div>
</section>
```

### Fragment events

When a slide fragment is either shown or hidden reveal.js will dispatch an event.
Expand Down
14 changes: 13 additions & 1 deletion css/reveal.css
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,19 @@ body {
.reveal .slides section .fragment.highlight-current-blue.current-fragment {
color: #1b91ff; }

/*********************************************
* COLLAPSIBLE FRAGMENTS
*********************************************/
.reveal .slides section pre.fragment.collapsible,
.reveal .slides section p.fragment.collapsible,
.reveal .slides section div.fragment.collapsible {
display: none; }

.reveal .slides section pre.fragment.current-fragment,
.reveal .slides section p.fragment.current-fragment,
.reveal .slides section div.fragment.current-fragment {
display: block; }

/*********************************************
* DEFAULT ELEMENT STYLES
*********************************************/
Expand Down Expand Up @@ -1143,7 +1156,6 @@ body {
.reveal .overlay .viewport {
position: absolute;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
top: 40px;
Expand Down
16 changes: 16 additions & 0 deletions css/reveal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,22 @@ body {
color: #1b91ff;
}

/*********************************************
* COLLAPSIBLE FRAGMENTS
*********************************************/

.reveal .slides section pre.fragment.collapsible,
.reveal .slides section p.fragment.collapsible,
.reveal .slides section div.fragment.collapsible {
display: none;
}

.reveal .slides section pre.fragment.current-fragment,
.reveal .slides section p.fragment.current-fragment,
.reveal .slides section div.fragment.current-fragment {
display: block;
}


/*********************************************
* DEFAULT ELEMENT STYLES
Expand Down