add support for data-visibility=hidden

This commit is contained in:
Hakim El Hattab
2020-06-02 13:47:34 +02:00
parent c91074761a
commit d272628f58
6 changed files with 38 additions and 2 deletions

View File

@@ -174,6 +174,9 @@ export default function( revealElement, options ) {
ready = true;
// Remove slides hidden with data-visibility
removeHiddenSlides();
// Make sure we've got all the DOM elements we need
setupDOM();
@@ -231,6 +234,24 @@ export default function( revealElement, options ) {
}
/**
* Removes all slides with data-visibility="hidden". This
* is done right before the rest of the presentation is
* initialized.
*
* If you want to show all hidden slides, initialize
* reveal.js with showHiddenSlides set to true.
*/
function removeHiddenSlides() {
if( !config.showHiddenSlides ) {
Util.queryAll( dom.wrapper, 'section[data-visibility="hidden"]' ).forEach( slide => {
slide.parentNode.removeChild( slide );
} );
}
}
/**
* Finds and stores references to DOM elements which are
* required by the presentation. If a required element is