Skip to content

Commit

Permalink
add support for data-visibility='uncounted' #2543
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Mar 5, 2020
2 parents 5c24818 + 773b511 commit 4b888d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,11 @@ Reveal.addEventListener( 'somestate', function() {
}, false );
```

### Slide Visibility
When preparing a presentation it can sometimes be helpful to prepare optional slides that you may or may not have time to show. This is easily done by appending a few slides at the end of the presentation, however this means that the reveal.js progress bar and slide numbering will hint that there are additional slides.

To "hide" those slides from reveal.js' numbering system you can add a `data-visibility` attribute to the slide like so `<section data-visibility="uncounted">`.

### Slide Backgrounds

Slides are contained within a limited portion of the screen by default to allow them to fit any display and scale uniformly. You can apply full page backgrounds outside of the slide area by adding a `data-background` attribute to your `<section>` elements. Four different types of backgrounds are supported: color, image, video and iframe.
Expand Down
12 changes: 8 additions & 4 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4856,7 +4856,10 @@
break mainLoop;
}

pastCount++;
// Don't count slides with the "uncounted" class
if( verticalSlides[j].dataset.visibility !== 'uncounted' ) {
pastCount++;
}

}

Expand All @@ -4865,8 +4868,9 @@
break;
}

// Don't count the wrapping section for vertical slides
if( horizontalSlide.classList.contains( 'stack' ) === false ) {
// Don't count the wrapping section for vertical slides and
// slides marked as uncounted
if( horizontalSlide.classList.contains( 'stack' ) === false && !horizontalSlide.dataset.visibility !== 'uncounted' ) {
pastCount++;
}

Expand Down Expand Up @@ -5078,7 +5082,7 @@
*/
function getSlides() {

return toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ':not(.stack)' ) );
return toArray( dom.wrapper.querySelectorAll( SLIDES_SELECTOR + ':not(.stack):not([data-visibility="uncounted"])' ) );

}

Expand Down

0 comments on commit 4b888d8

Please # to comment.