diff --git a/README.md b/README.md index 02775537..b30a4fbe 100644 --- a/README.md +++ b/README.md @@ -117,22 +117,22 @@ Some reveal.js features, like external Markdown and speaker notes, require that Here's a barebones example of a fully working reveal.js presentation: ```html -
- - - - - elements
- { src: 'plugin/highlight/highlight.js', async: true },
+ // Syntax highlight for elements
+ { src: 'plugin/highlight/highlight.js', async: true },
- // Zoom in and out with Alt+click
- { src: 'plugin/zoom-js/zoom.js', async: true },
+ // Zoom in and out with Alt+click
+ { src: 'plugin/zoom-js/zoom.js', async: true },
- // Speaker notes
- { src: 'plugin/notes/notes.js', async: true },
+ // Speaker notes
+ { src: 'plugin/notes/notes.js', async: true },
- // MathJax
- { src: 'plugin/math/math.js', async: true }
- ]
+ // MathJax
+ { src: 'plugin/math/math.js', async: true }
+ ]
});
```
@@ -473,7 +476,7 @@ A `ready` event is fired when reveal.js has loaded all non-async dependencies an
```javascript
Reveal.on( 'ready', function( event ) {
- // event.currentSlide, event.indexh, event.indexv
+ // event.currentSlide, event.indexh, event.indexv
} );
```
@@ -496,9 +499,9 @@ You can also override the slide duration for individual slides and fragments by
```html
- After 2 seconds the first fragment will be shown.
- After 10 seconds the next fragment will be shown.
- Now, the fragment is displayed for 2 seconds before the next slide is shown.
+ After 2 seconds the first fragment will be shown.
+ After 10 seconds the next fragment will be shown.
+ Now, the fragment is displayed for 2 seconds before the next slide is shown.
```
@@ -527,10 +530,10 @@ reveal.js can automatically animate elements across slides. All you need to do i
Here's a simple example to give you a better idea of how it can be used. The resulting animation will be the word "Magic" sliding 100px downwards.
```html
- Magic
+ Magic
- Magic
+ Magic
```
@@ -581,7 +584,7 @@ Each individual element is decorated with a `data-auto-animate-target` attribute
Each time a presentation navigates between two auto-animated slides it dispatches the `autoanimate` event.
```javascript
Reveal.on( 'autoanimate', function( event ) {
- // event.fromSlide, event.toSlide
+ // event.fromSlide, event.toSlide
} );
```
@@ -634,7 +637,7 @@ according to the `viewDistance`.
```html
-
+
```
@@ -732,12 +735,12 @@ For example
// key: the key label to show in the help overlay
// description: the description of the action to show in the help overlay
Reveal.addKeyBinding( { keyCode: 84, key: 'T', description: 'Start timer' }, function() {
- // start timer
+ // start timer
} )
// The binding parameter can also be a direct keycode without providing the help description
Reveal.addKeyBinding( 82, function() {
- // reset timer
+ // reset timer
} )
```
@@ -754,7 +757,7 @@ Some libraries, like MathJax (see [#226](https://github.com/hakimel/reveal.js/is
```javascript
Reveal.on( 'slidechanged', function( event ) {
- // event.previousSlide, event.currentSlide, event.indexh, event.indexv
+ // event.previousSlide, event.currentSlide, event.indexh, event.indexv
} );
```
@@ -783,7 +786,7 @@ Furthermore you can also listen to these changes in state via JavaScript:
```javascript
Reveal.on( 'somestate', function() {
- // TODO: Sprinkle magic
+ // TODO: Sprinkle magic
}, false );
```
@@ -802,7 +805,7 @@ All CSS color formats are supported, including hex values, keywords, `rgba()` or
```html
- Color
+ Color
```
@@ -820,10 +823,10 @@ By default, background images are resized to cover the full page. Available opti
```html
- Image
+ Image
- This background image will be sized to 100px and repeated
+ This background image will be sized to 100px and repeated
```
@@ -841,7 +844,7 @@ Automatically plays a full size video behind the slide.
```html
- Video
+ Video
```
@@ -851,7 +854,7 @@ Embeds a web page as a slide background that covers 100% of the reveal.js width
```html
- Iframe
+ Iframe
```
@@ -869,17 +872,17 @@ If you want to use a parallax scrolling background, set the first two properties
```javascript
Reveal.initialize({
- // Parallax background image
- parallaxBackgroundImage: '', // e.g. "https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg"
+ // Parallax background image
+ parallaxBackgroundImage: '', // e.g. "https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg"
- // Parallax background size
- parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px" - currently only pixels are supported (don't use % or auto)
+ // Parallax background size
+ parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px" - currently only pixels are supported (don't use % or auto)
- // Number of pixels to move the parallax background per slide
- // - Calculated automatically unless specified
- // - Set to 0 to disable movement along an axis
- parallaxBackgroundHorizontal: 200,
- parallaxBackgroundVertical: 50
+ // Number of pixels to move the parallax background per slide
+ // - Calculated automatically unless specified
+ // - Set to 0 to disable movement along an axis
+ parallaxBackgroundHorizontal: 200,
+ parallaxBackgroundVertical: 50
});
```
@@ -892,11 +895,11 @@ The global presentation transition is set using the `transition` config value. Y
```html
- This slide will override the presentation transition and zoom!
+ This slide will override the presentation transition and zoom!
- Choose from three transition speeds: default, fast or slow!
+ Choose from three transition speeds: default, fast or slow!
```
@@ -948,17 +951,17 @@ The default fragment style is to start out invisible and fade in. This style can
```html
- grow
- shrink
- strike
- fade-out
- fade-up (also down, left and right!)
- fades in, then out when we move to the next step
- fades in, then obfuscate when we move to the next step
- blue only once
- highlight-red
- highlight-green
- highlight-blue
+ grow
+ shrink
+ strike
+ fade-out
+ fade-up (also down, left and right!)
+ fades in, then out when we move to the next step
+ fades in, then obfuscate when we move to the next step
+ blue only once
+ highlight-red
+ highlight-green
+ highlight-blue
```
@@ -966,9 +969,9 @@ Multiple fragments can be applied to the same element sequentially by wrapping i
```html
-
- I'll fade in, then out
-
+
+ I'll fade in, then out
+
```
@@ -976,9 +979,9 @@ The display order of fragments can be controlled using the `data-fragment-index`
```html
- Appears last
- Appears first
- Appears second
+ Appears last
+ Appears first
+ Appears second
```
@@ -990,10 +993,10 @@ Some libraries, like MathJax (see #505), get confused by the initially hidden fr
```javascript
Reveal.on( 'fragmentshown', function( event ) {
- // event.fragment = the fragment DOM element
+ // event.fragment = the fragment DOM element
} );
Reveal.on( 'fragmenthidden', function( event ) {
- // event.fragment = the fragment DOM element
+ // event.fragment = the fragment DOM element
} );
```
@@ -1003,10 +1006,10 @@ By default, Reveal is configured with [highlight.js](https://highlightjs.org/) f
```javascript
Reveal.initialize({
- // More info https://github.com/hakimel/reveal.js#dependencies
- dependencies: [
- { src: 'plugin/highlight/highlight.js', async: true },
- ]
+ // More info https://github.com/hakimel/reveal.js#dependencies
+ dependencies: [
+ { src: 'plugin/highlight/highlight.js', async: true },
+ ]
});
```
@@ -1014,13 +1017,13 @@ Below is an example with clojure code that will be syntax highlighted. When the
```html
-
+
(def lazy-fib
(concat
[0 1]
((fn rfib [a b]
(lazy-cons (+ a b) (rfib b (+ a b)))) 0 1)))
-
+
```
@@ -1064,10 +1067,10 @@ If you would like to display the page number of the current slide you can do so
Reveal.configure({ slideNumber: true });
// Slide number formatting can be configured using these variables:
-// "h.v": horizontal . vertical slide number (default)
-// "h/v": horizontal / vertical slide number
-// "c": flattened slide number
-// "c/t": flattened slide number / total slides
+// "h.v": horizontal . vertical slide number (default)
+// "h/v": horizontal / vertical slide number
+// "c": flattened slide number
+// "c/t": flattened slide number / total slides
Reveal.configure({ slideNumber: 'c/t' });
// You can provide a function to fully customize the number:
@@ -1122,7 +1125,7 @@ Sometimes it's desirable to have an element, like an image or video, stretch to
```html
- This video will use up the remaining space on the slide
+ This video will use up the remaining space on the slide
```
@@ -1137,7 +1140,7 @@ When reveal.js changes the scale of the slides it fires a resize event. You can
```javascript
Reveal.on( 'resize', function( event ) {
- // event.scale, event.oldScale, event.size
+ // event.scale, event.oldScale, event.size
} );
```
@@ -1155,10 +1158,10 @@ When reveal.js runs inside of an iframe it can optionally bubble all of its even
```javascript
window.addEventListener( 'message', function( event ) {
- var data = JSON.parse( event.data );
- if( data.namespace === 'reveal' && data.eventName === 'slidechanged' ) {
- // Slide changed, see data.state for slide number
- }
+ var data = JSON.parse( event.data );
+ if( data.namespace === 'reveal' && data.eventName === 'slidechanged' ) {
+ // Slide changed, see data.state for slide number
+ }
} );
```
@@ -1170,11 +1173,11 @@ When you call any method via the postMessage API, reveal.js will dispatch a mess
.postMessage( JSON.stringify({ method: 'getTotalSlides' }), '*' );
window.addEventListener( 'message', function( event ) {
- var data = JSON.parse( event.data );
- // `data.method`` is the method that we invoked
- if( data.namespace === 'reveal' && data.eventName === 'callback' && data.method === 'getTotalSlides' ) {
- data.result // = the total number of slides
- }
+ var data = JSON.parse( event.data );
+ // `data.method`` is the method that we invoked
+ if( data.namespace === 'reveal' && data.eventName === 'callback' && data.method === 'getTotalSlides' ) {
+ data.result // = the total number of slides
+ }
} );
```
@@ -1184,13 +1187,13 @@ This cross-window messaging can be toggled on or off using configuration flags.
```javascript
Reveal.initialize({
- // ...
+ // ...
- // Exposes the reveal.js API through window.postMessage
- postMessage: true,
+ // Exposes the reveal.js API through window.postMessage
+ postMessage: true,
- // Dispatches all reveal.js events to the parent window through postMessage
- postMessageEvents: false
+ // Dispatches all reveal.js events to the parent window through postMessage
+ postMessageEvents: false
});
```
@@ -1202,11 +1205,11 @@ This is based on [data-markdown](https://gist.github.com/1343518) from [Paul Iri
```html
-
```
@@ -1235,10 +1238,10 @@ Special syntax (through HTML comments) is available for adding attributes to Mar
```html
-
+
```
@@ -1248,10 +1251,10 @@ Special syntax (through HTML comments) is available for adding attributes to the
```html
-
+
```
@@ -1261,11 +1264,11 @@ We use [marked](https://github.com/chjj/marked) to parse Markdown. To customise
```javascript
Reveal.initialize({
- // Options which are passed into marked
- // See https://marked.js.org/#/USING_ADVANCED.md#options
- markdown: {
- smartypants: true
- }
+ // Options which are passed into marked
+ // See https://marked.js.org/#/USING_ADVANCED.md#options
+ markdown: {
+ smartypants: true
+ }
});
```
@@ -1337,11 +1340,11 @@ When used locally, this feature requires that reveal.js [runs from a local web s
```html
- Some Slide
+ Some Slide
-
+
```
@@ -1382,12 +1385,12 @@ In some cases it can be desirable to run notes on a separate device from the one
```javascript
Reveal.initialize({
- // ...
+ // ...
- dependencies: [
- { src: 'socket.io/socket.io.js', async: true },
- { src: 'plugin/notes-server/client.js', async: true }
- ]
+ dependencies: [
+ { src: 'socket.io/socket.io.js', async: true },
+ { src: 'plugin/notes-server/client.js', async: true }
+ ]
});
```
@@ -1406,7 +1409,7 @@ When reveal.js is booted up via `Reveal.initialize()`, it will go through all re
```javascript
let MyPlugin = {
- init: () => new Promise( resolve => setTimeout( resolve, 3000 ) )
+ init: () => new Promise( resolve => setTimeout( resolve, 3000 ) )
};
Reveal.registerPlugin( 'myPlugin', MyPlugin );
Reveal.on( 'ready', () => console.log( 'Three seconds later...' ) );
@@ -1445,25 +1448,25 @@ Example configuration:
```javascript
Reveal.initialize({
- // other options...
+ // other options...
- multiplex: {
- // Example values. To generate your own, see the socket.io server instructions.
- secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
- id: '1ea875674b17ca76', // Obtained from socket.io server
- url: 'https://reveal-js-multiplex-ccjbegmaii.now.sh' // Location of socket.io server
- },
+ multiplex: {
+ // Example values. To generate your own, see the socket.io server instructions.
+ secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
+ id: '1ea875674b17ca76', // Obtained from socket.io server
+ url: 'https://reveal-js-multiplex-ccjbegmaii.now.sh' // Location of socket.io server
+ },
- // Don't forget to add the dependencies
- dependencies: [
- { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js', async: true },
- { src: 'plugin/multiplex/master.js', async: true },
+ // Don't forget to add the dependencies
+ dependencies: [
+ { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js', async: true },
+ { src: 'plugin/multiplex/master.js', async: true },
- // and if you want speaker notes
- { src: 'plugin/notes-server/client.js', async: true }
+ // and if you want speaker notes
+ { src: 'plugin/notes-server/client.js', async: true }
- // other dependencies...
- ]
+ // other dependencies...
+ ]
});
```
@@ -1475,22 +1478,22 @@ Example configuration:
```javascript
Reveal.initialize({
- // other options...
+ // other options...
- multiplex: {
- // Example values. To generate your own, see the socket.io server instructions.
- secret: null, // null so the clients do not have control of the master presentation
- id: '1ea875674b17ca76', // id, obtained from socket.io server
- url: 'https://reveal-js-multiplex-ccjbegmaii.now.sh' // Location of socket.io server
- },
+ multiplex: {
+ // Example values. To generate your own, see the socket.io server instructions.
+ secret: null, // null so the clients do not have control of the master presentation
+ id: '1ea875674b17ca76', // id, obtained from socket.io server
+ url: 'https://reveal-js-multiplex-ccjbegmaii.now.sh' // Location of socket.io server
+ },
- // Don't forget to add the dependencies
- dependencies: [
- { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js', async: true },
- { src: 'plugin/multiplex/client.js', async: true }
+ // Don't forget to add the dependencies
+ dependencies: [
+ { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js', async: true },
+ { src: 'plugin/multiplex/client.js', async: true }
- // other dependencies...
- ]
+ // other dependencies...
+ ]
});
```
@@ -1517,22 +1520,22 @@ Example configuration:
```javascript
Reveal.initialize({
- // other options...
+ // other options...
- multiplex: {
- // Example values. To generate your own, see the socket.io server instructions.
- secret: null, // null so the clients do not have control of the master presentation
- id: '1ea875674b17ca76', // id, obtained from socket.io server
- url: 'example.com:80' // Location of your socket.io server
- },
+ multiplex: {
+ // Example values. To generate your own, see the socket.io server instructions.
+ secret: null, // null so the clients do not have control of the master presentation
+ id: '1ea875674b17ca76', // id, obtained from socket.io server
+ url: 'example.com:80' // Location of your socket.io server
+ },
- // Don't forget to add the dependencies
- dependencies: [
- { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js', async: true },
- { src: 'plugin/multiplex/client.js', async: true }
+ // Don't forget to add the dependencies
+ dependencies: [
+ { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js', async: true },
+ { src: 'plugin/multiplex/client.js', async: true }
- // other dependencies...
- ]
+ // other dependencies...
+ ]
```
It can also play the role of static file server for your master presentation and client presentations at the same time (as long as you don't want to use speaker notes). (Open [https://reveal-js-multiplex-ccjbegmaii.now.sh/](https://reveal-js-multiplex-ccjbegmaii.now.sh/) in two browsers. Navigate through the slides on one, and the other will update to match. Navigate through the slides on the second, and the first will update to match.) This is probably not desirable, because you don't want your audience to mess with your slides while you're presenting. ;)
@@ -1541,23 +1544,23 @@ Example configuration:
```javascript
Reveal.initialize({
- // other options...
+ // other options...
- multiplex: {
- // Example values. To generate your own, see the socket.io server instructions.
- secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
- id: '1ea875674b17ca76', // Obtained from socket.io server
- url: 'example.com:80' // Location of your socket.io server
- },
+ multiplex: {
+ // Example values. To generate your own, see the socket.io server instructions.
+ secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
+ id: '1ea875674b17ca76', // Obtained from socket.io server
+ url: 'example.com:80' // Location of your socket.io server
+ },
- // Don't forget to add the dependencies
- dependencies: [
- { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js', async: true },
- { src: 'plugin/multiplex/master.js', async: true },
- { src: 'plugin/multiplex/client.js', async: true }
+ // Don't forget to add the dependencies
+ dependencies: [
+ { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js', async: true },
+ { src: 'plugin/multiplex/master.js', async: true },
+ { src: 'plugin/multiplex/client.js', async: true }
- // other dependencies...
- ]
+ // other dependencies...
+ ]
});
```
@@ -1572,18 +1575,18 @@ Below is an example of how the plugin can be configured. If you don't intend to
```js
Reveal.initialize({
- // other options ...
+ // other options ...
- math: {
- mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js',
- config: 'TeX-AMS_HTML-full', // See http://docs.mathjax.org/en/latest/config-files.html
- // pass other options into `MathJax.Hub.Config()`
- TeX: { Macros: { RR: "{\\bf R}" } }
- },
+ math: {
+ mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js',
+ config: 'TeX-AMS_HTML-full', // See http://docs.mathjax.org/en/latest/config-files.html
+ // pass other options into `MathJax.Hub.Config()`
+ TeX: { Macros: { RR: "{\\bf R}" } }
+ },
- dependencies: [
- { src: 'plugin/math/math.js', async: true }
- ]
+ dependencies: [
+ { src: 'plugin/math/math.js', async: true }
+ ]
});
```