add support for data-visibility=hidden
This commit is contained in:
@ -146,6 +146,9 @@ export default {
|
||||
// Flags if speaker notes should be visible to all viewers
|
||||
showNotes: false,
|
||||
|
||||
// Flags if slides with data-visibility="hidden" should be kep visible
|
||||
showHiddenSlides: false,
|
||||
|
||||
// Global override for autolaying embedded media (video/audio/iframe)
|
||||
// - null: Media will only autoplay if data-autoplay is present
|
||||
// - true: All media will autoplay, regardless of individual setting
|
||||
|
21
js/reveal.js
21
js/reveal.js
@ -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
|
||||
|
Reference in New Issue
Block a user