change slide number formats
This commit is contained in:
parent
35462a424c
commit
0198d74391
4 changed files with 36 additions and 18 deletions
|
@ -611,10 +611,9 @@ If you would like to display the page number of the current slide you can do so
|
||||||
Reveal.configure({ slideNumber: true });
|
Reveal.configure({ slideNumber: true });
|
||||||
|
|
||||||
// Slide number formatting can be configured using these variables:
|
// Slide number formatting can be configured using these variables:
|
||||||
// h: current slide's horizontal index
|
// "h/v": horizontal and vertical slide numbers (default)
|
||||||
// v: current slide's vertical index
|
// "c": flattened slide number
|
||||||
// c: current slide index (flattened)
|
// "c/t": flattened slide number / total slides
|
||||||
// t: total number of slides (flattened)
|
|
||||||
Reveal.configure({ slideNumber: 'c/t' });
|
Reveal.configure({ slideNumber: 'c/t' });
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -279,6 +279,9 @@ html:-moz-full-screen-ancestor {
|
||||||
z-index: 31;
|
z-index: 31;
|
||||||
font-size: 12px; }
|
font-size: 12px; }
|
||||||
|
|
||||||
|
.reveal .slide-number-delimiter {
|
||||||
|
margin: 0 4px; }
|
||||||
|
|
||||||
/*********************************************
|
/*********************************************
|
||||||
* SLIDES
|
* SLIDES
|
||||||
*********************************************/
|
*********************************************/
|
||||||
|
|
|
@ -336,6 +336,10 @@ html:-moz-full-screen-ancestor {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.reveal .slide-number-delimiter {
|
||||||
|
margin: 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************
|
/*********************************************
|
||||||
* SLIDES
|
* SLIDES
|
||||||
*********************************************/
|
*********************************************/
|
||||||
|
|
38
js/reveal.js
38
js/reveal.js
|
@ -2512,30 +2512,42 @@
|
||||||
/**
|
/**
|
||||||
* Updates the slide number div to reflect the current slide.
|
* Updates the slide number div to reflect the current slide.
|
||||||
*
|
*
|
||||||
* Slide number format can be defined as a string using the
|
* The following slide number formats are available:
|
||||||
* following variables:
|
* "h/v": horizontal and vertical slide numbers (default)
|
||||||
* h: current slide's horizontal index
|
* "c": flattened slide number
|
||||||
* v: current slide's vertical index
|
* "c/t": flattened slide number / total slides
|
||||||
* c: current slide index (flattened)
|
|
||||||
* t: total number of slides (flattened)
|
|
||||||
*/
|
*/
|
||||||
function updateSlideNumber() {
|
function updateSlideNumber() {
|
||||||
|
|
||||||
// Update slide number if enabled
|
// Update slide number if enabled
|
||||||
if( config.slideNumber && dom.slideNumber) {
|
if( config.slideNumber && dom.slideNumber) {
|
||||||
|
|
||||||
// Default to only showing the current slide number
|
var value = [];
|
||||||
var format = 'c';
|
var format = 'h/v';
|
||||||
|
|
||||||
// Check if a custom slide 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
dom.slideNumber.innerHTML = format.replace( /h/g, indexh )
|
if( format === 'c' ) {
|
||||||
.replace( /v/g, indexv )
|
value.push( getSlidePastCount() + 1 );
|
||||||
.replace( /c/g, getSlidePastCount() + 1 )
|
}
|
||||||
.replace( /t/g, getTotalSlides() );
|
else if( format === 'c/t' ) {
|
||||||
|
value.push( getSlidePastCount() + 1 );
|
||||||
|
value.push( '<span class="slide-number-delimiter">/</span>' );
|
||||||
|
value.push( getTotalSlides() );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
value.push( indexh + 1 );
|
||||||
|
|
||||||
|
if( isVerticalSlide() ) {
|
||||||
|
value.push( '<span class="slide-number-delimiter">/</span>' );
|
||||||
|
value.push( indexv + 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dom.slideNumber.innerHTML = value.join( '' );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue