documentation for #2315

This commit is contained in:
Hakim El Hattab 2019-02-01 10:15:10 +01:00
parent d0337246f2
commit ce53e63b5b
2 changed files with 28 additions and 17 deletions

View File

@ -937,6 +937,12 @@ Reveal.configure({ slideNumber: true });
// "c/t": flattened slide number / total slides // "c/t": flattened slide number / total slides
Reveal.configure({ slideNumber: 'c/t' }); Reveal.configure({ slideNumber: 'c/t' });
// You can provide a function to fully customize the number:
Reveal.configure({ slideNumber: function() {
// Ignore numbering of vertical slides
return [ Reveal.getIndices().h ];
}});
// Control which views the slide number displays on using the "showSlideNumber" value: // Control which views the slide number displays on using the "showSlideNumber" value:
// "all": show on all views (default) // "all": show on all views (default)
// "speaker": only show slide numbers on speaker notes view // "speaker": only show slide numbers on speaker notes view

View File

@ -67,18 +67,31 @@
progress: true, progress: true,
// Display the page number of the current slide // Display the page number of the current slide
// - true: Show slide number
// - false: Hide slide number
//
// Can optionally be set as a string that specifies the number formatting:
// - "h.v": Horizontal . vertical slide number (default)
// - "h/v": Horizontal / vertical slide number
// - "c": Flattened slide number
// - "c/t": Flattened slide number / total slides
//
// Alternatively, you can provide a function that returns the slide
// number for the current slide. The function needs to return an array
// with one string [slideNumber] or three strings [n1,delimiter,n2].
// See #formatSlideNumber().
slideNumber: false, slideNumber: false,
// Use 1 based indexing for # links to match slide number (default is zero // Can be used to limit the contexts in which the slide number appears
// based)
hashOneBasedIndex: false,
// Controls which contexts the slide number should appear in
// - "all": Always show the slide number // - "all": Always show the slide number
// - "print": Only when printing to PDF // - "print": Only when printing to PDF
// - "speaker": Only in the speaker view // - "speaker": Only in the speaker view
showSlideNumber: 'all', showSlideNumber: 'all',
// Use 1 based indexing for # links to match slide number (default is zero
// based)
hashOneBasedIndex: false,
// Add the current slide number to the URL hash so that reloading the // Add the current slide number to the URL hash so that reloading the
// page/copying the URL will return you to the same slide // page/copying the URL will return you to the same slide
hash: false, hash: false,
@ -3262,16 +3275,7 @@
/** /**
* Updates the slide number div to reflect the current slide. * Updates the slide number to match the current slide.
*
* The following slide number formats are available:
* "h.v": horizontal . vertical slide number (default)
* "h/v": horizontal / vertical slide number
* "c": flattened slide number
* "c/t": flattened slide number / total slides
*
* Alternatively, config.slideNumber can be a function returning a
* three-element array with arguments to formatSlideNumber().
*/ */
function updateSlideNumber() { function updateSlideNumber() {
@ -3281,9 +3285,10 @@
var value; var value;
var format = 'h.v'; var format = 'h.v';
if ( typeof config.slideNumber === 'function' ) { if( typeof config.slideNumber === 'function' ) {
value = config.slideNumber(); value = config.slideNumber();
} else { }
else {
// Check if a custom number format is available // Check if a custom number format is available
if( typeof config.slideNumber === 'string' ) { if( typeof config.slideNumber === 'string' ) {
format = config.slideNumber; format = config.slideNumber;