aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md11
-rw-r--r--js/reveal.js14
2 files changed, 24 insertions, 1 deletions
diff --git a/README.md b/README.md
index 170fe48..b8ad6a0 100644
--- a/README.md
+++ b/README.md
@@ -42,6 +42,7 @@ reveal.js comes with a broad range of features including [nested slides](https:/
- [Fullscreen mode](#fullscreen-mode)
- [Embedded media](#embedded-media)
- [Stretching elements](#stretching-elements)
+ - [Resize Event](#resize-event)
- [postMessage API](#postmessage-api)
- [PDF Export](#pdf-export)
- [Theming](#theming)
@@ -991,6 +992,16 @@ Limitations:
- Only direct descendants of a slide section can be stretched
- Only one descendant per slide section can be stretched
+### Resize Event
+
+When reveal.js changes the scale of the slides it fires a resize event. You can subscribe to the event to resize your elements accordingly.
+
+```javascript
+Reveal.addEventListener( 'resize', function( event ) {
+ // event.scale, event.oldScale, event.size
+} );
+```
+
### postMessage API
The framework has a built-in postMessage API that can be used when communicating with a presentation inside of another window. Here's an example showing how you'd make a reveal.js instance in the given window proceed to slide 2:
diff --git a/js/reveal.js b/js/reveal.js
index 240dc42..8feb45d 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -73,7 +73,10 @@
// based)
hashOneBasedIndex: false,
- // Determine which displays to show the slide number on
+ // Controls which contexts the slide number should appear in
+ // - "all": Always show the slide number
+ // - "print": Only when printing to PDF
+ // - "speaker": Only in the speaker view
showSlideNumber: 'all',
// Add the current slide number to the URL hash so that reloading the
@@ -2097,6 +2100,8 @@
var size = getComputedSlideSize();
+ var oldScale = scale;
+
// Layout the contents of the slides
layoutSlideContents( config.width, config.height );
@@ -2169,6 +2174,13 @@
}
+ if( oldScale !== scale ) {
+ dispatchEvent( 'resize', {
+ 'oldScale': oldScale,
+ 'scale': scale,
+ 'size': size
+ } );
+ }
}
updateProgress();