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

Simplify fragments for lists #1211

Closed
kjetilk opened this issue Apr 24, 2015 · 3 comments
Closed

Simplify fragments for lists #1211

kjetilk opened this issue Apr 24, 2015 · 3 comments

Comments

@kjetilk
Copy link

kjetilk commented Apr 24, 2015

It seems like if I have a list, I would have to go

<ul>
  <li class="fragment">Foo</li>
  <li class="fragment">Bar</li>
</ul>

To get the common behaviour of one item per forward action. It would be nice if this could be simplied to something like

<ul class="fragments">
  <li>Foo</li>
  <li>Bar</li>
</ul>

I suppose you could do this for any block level element, so you could do

<div class="fragments">
  <p>Foo</p>
  <p>Bar</p>
</div>

But the interesting special case is for definition lists where the dt and dd should be presented together.

@bnjmnt4n
Copy link
Collaborator

bnjmnt4n commented Mar 6, 2016

I think this is rather complicated, and won’t be suitable for reveal.js, as there are many different elements, both block and inline with different semantics. Feel free to implement a plugin for this.

@benjaminmordaunt
Copy link

benjaminmordaunt commented Feb 1, 2021

I second this issue - it is far more annoying when using Markdown, as you have to label every single list item with <!-- .element: class="fragment" -->. That gets irritating quickly. @bnjmnt4n

@maiermic
Copy link

You can use this script

Reveal.addEventListener("ready", function addFragmentToLists() {
  for (const listItem of document.querySelectorAll(".fragmented-lists li")) {
    listItem.classList.add("fragment");
  }
});

which adds the class fragment to all list items that are descendants of an element with class fragmented-lists, e.g.

<!-- .slide: class="fragmented-lists" -->

## Fragmented List
- foo
- bar

---

## Regular List
- foo
- bar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants