Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow configuration of which view slide number appears on - fixes #1791 #1833

Merged
merged 2 commits into from
Feb 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ By default, Reveal is configured with [highlight.js](https://highlightjs.org/) f
```

### Slide number
If you would like to display the page number of the current slide you can do so using the ```slideNumber``` configuration value.
If you would like to display the page number of the current slide you can do so using the ```slideNumber``` and ```showSlideNumber``` configuration values.

```javascript
// Shows the slide number using default formatting
Expand All @@ -762,6 +762,11 @@ Reveal.configure({ slideNumber: true });
// "c/t": flattened slide number / total slides
Reveal.configure({ slideNumber: 'c/t' });

// Control which views the slide number displays on using the "showSlideNumber" value.
// "all": show on all views (default)
// "notes": only show slide numbers on speaker notes view
Reveal.configure({ showSlideNumber: 'notes' });

```


Expand Down
16 changes: 15 additions & 1 deletion js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@

// Display the page number of the current slide
slideNumber: false,

// Determine which displays to show the slide number on
showSlideNumber: 'all',

// Push each slide change to the browser history
history: false,
Expand Down Expand Up @@ -977,7 +980,18 @@

dom.controls.style.display = config.controls ? 'block' : 'none';
dom.progress.style.display = config.progress ? 'block' : 'none';
dom.slideNumber.style.display = config.slideNumber && !isPrintingPDF() ? 'block' : 'none';

var slideNumberDisplay = 'none';
if (config.slideNumber && !isPrintingPDF()) {
if (config.showSlideNumber === 'all') {
slideNumberDisplay = 'block';
}
else if (config.showSlideNumber === 'notes' && isSpeakerNotes()) {
slideNumberDisplay = 'block';
}
}

dom.slideNumber.style.display = slideNumberDisplay;

if( config.shuffle ) {
shuffle();
Expand Down