فهرست منبع

add support for data-visibility='uncounted' #2543

Hakim El Hattab 5 سال پیش
والد
کامیت
4b888d87b7
2فایلهای تغییر یافته به همراه13 افزوده شده و 4 حذف شده
  1. 5 0
      README.md
  2. 8 4
      js/reveal.js

+ 5 - 0
README.md

@@ -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.

+ 8 - 4
js/reveal.js

@@ -4856,7 +4856,10 @@
 					break mainLoop;
 				}
 
-				pastCount++;
+				// Don't count slides with the "uncounted" class
+				if( verticalSlides[j].dataset.visibility !== 'uncounted' ) {
+					pastCount++;
+				}
 
 			}
 
@@ -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++;
 			}
 
@@ -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"])' ) );
 
 	}