diff options
author | Chris Lawrence | 2013-06-21 17:57:09 -0400 |
---|---|---|
committer | Chris Lawrence | 2013-06-21 17:57:09 -0400 |
commit | 7b119763f82fab69fd43c49f4af39481dd556cab (patch) | |
tree | 3aa6b5bec29132c22afa552beb851c8f785daa16 /README.md | |
parent | 636a6661978d04791bc899be65d7c3fd23eea125 (diff) | |
parent | e51c0fc3ce3568eb325b87fe60ca7bdd07861150 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 156 |
1 files changed, 100 insertions, 56 deletions
@@ -106,6 +106,9 @@ Reveal.initialize({ // Transition speed transitionSpeed: 'default', // default/fast/slow + // Transition style for full page backgrounds + backgroundTransition: 'default' // default/linear + }); ``` @@ -123,34 +126,6 @@ Reveal.configure({ autoSlide: 5000 }); ``` -### Presentation Size - -All presentations have a normal size, that is the resolution at which they are authored. The framework will automatically scale presentations uniformly based on this size to ensure that everything fits on any given display or viewport. - -See below for a list of configuration options related to sizing, including default values: - -```javascript -Reveal.initialize({ - - ... - - // The "normal" size of the presentation, aspect ratio will be preserved - // when the presentation is scaled to fit different resolutions. Can be - // specified using percentage units. - width: 960, - height: 700, - - // Factor of the display size that should remain empty around the content - margin: 0.1, - - // Bounds for smallest/largest possible scale to apply to content - minScale: 0.2, - maxScale: 1.0 - -}); -``` - - ### Dependencies Reveal.js doesn't _rely_ on any third party scripts to work but a few optional libraries are included by default. These libraries are loaded as dependencies in the order they appear, for example: @@ -187,9 +162,51 @@ You can add your own extensions using the same syntax. The following properties - **condition**: [optional] Function which must return true for the script to be loaded +### Presentation Size + +All presentations have a normal size, that is the resolution at which they are authored. The framework will automatically scale presentations uniformly based on this size to ensure that everything fits on any given display or viewport. + +See below for a list of configuration options related to sizing, including default values: + +```javascript +Reveal.initialize({ + + ... + + // The "normal" size of the presentation, aspect ratio will be preserved + // when the presentation is scaled to fit different resolutions. Can be + // specified using percentage units. + width: 960, + height: 700, + + // Factor of the display size that should remain empty around the content + margin: 0.1, + + // Bounds for smallest/largest possible scale to apply to content + minScale: 0.2, + maxScale: 1.0 + +}); +``` + +### Keyboard Bindings + +If you're unhappy with any of the default keyboard bindings you can override them using the ```keyboard``` config option: + +```javascript +Reveal.configure({ + keyboard: { + 13: 'next', // go to the next slide when the ENTER key is pressed + 27: function() {}, // do something custom when ESC is pressed + 32: null // don't do anything when SPACE is pressed (i.e. disable a reveal.js default binding) + } +}); +``` + + ### API -The ``Reveal`` class provides a minimal JavaScript API for controlling navigation and reading state: +The ``Reveal`` class provides a JavaScript API for controlling navigation and reading state: ```javascript // Navigation @@ -203,27 +220,22 @@ Reveal.next(); Reveal.prevFragment(); Reveal.nextFragment(); Reveal.toggleOverview(); +Reveal.togglePause(); // Retrieves the previous and current slide elements Reveal.getPreviousSlide(); Reveal.getCurrentSlide(); Reveal.getIndices(); // { h: 0, v: 0 } } -``` - -### States - -If you set ``data-state="somestate"`` on a slide ``<section>``, "somestate" will be applied as a class on the document element when that slide is opened. This allows you to apply broad style changes to the page based on the active slide. - -Furthermore you can also listen to these changes in state via JavaScript: -```javascript -Reveal.addEventListener( 'somestate', function() { - // TODO: Sprinkle magic -}, false ); +// State checks +Reveal.isFirstSlide(); +Reveal.isLastSlide(); +Reveal.isOverview(); +Reveal.isPaused(); ``` -### Ready event +### Ready Event The 'ready' event is fired when reveal.js has loaded all (synchronous) dependencies and is ready to start navigating. @@ -233,7 +245,7 @@ Reveal.addEventListener( 'ready', function( event ) { } ); ``` -### Slide change event +### Slide Changed Event An 'slidechanged' event is fired each time the slide is changed (regardless of state). The event object holds the index values of the current slide as well as a reference to the previous and current slide HTML nodes. @@ -245,27 +257,39 @@ Reveal.addEventListener( 'slidechanged', function( event ) { } ); ``` -### Internal links -It's easy to link between slides. The first example below targets the index of another slide whereas the second targets a slide with an ID attribute (```<section id="some-slide">```): +### States -```html -<a href="#/2/2">Link</a> -<a href="#/some-slide">Link</a> +If you set ``data-state="somestate"`` on a slide ``<section>``, "somestate" will be applied as a class on the document element when that slide is opened. This allows you to apply broad style changes to the page based on the active slide. + +Furthermore you can also listen to these changes in state via JavaScript: + +```javascript +Reveal.addEventListener( 'somestate', function() { + // TODO: Sprinkle magic +}, false ); ``` -You can also add relative navigation links, similar to the built in reveal.js controls, by appending one of the following classes on any element. Note that each element is automatically given an ```enabled``` class when it's a valid navigation route based on the current slide. +### Slide Backgrounds + +Slides are contained within a limited portion of the screen by default to allow them to fit any display and scale uniformly. You can apply full page background colors or images by applying a ```data-background``` attribute to your ```<section>``` elements. Below are a few examples. ```html -<a href="#" class="navigate-left"> -<a href="#" class="navigate-right"> -<a href="#" class="navigate-up"> -<a href="#" class="navigate-down"> -<a href="#" class="navigate-prev"> <!-- Previous vertical or horizontal slide --> -<a href="#" class="navigate-next"> <!-- Next vertical or horizontal slide --> +<section data-background="#ff0000"> + <h2>All CSS color formats are supported, like rgba() or hsl().</h2> +</section> +<section data-background="http://example.com/image.png"> + <h2>This slide will have a full-size background image.</h2> +</section> +<section data-background="http://example.com/image.png" data-background-size="100px" data-background-repeat="repeat"> + <h2>This background image will be sized to 100px and repeated.</h2> +</section> ``` -### Alternating transitions +Backgrounds transition using a fade animation by default. This can be changed to a linear sliding transition by passing ```backgroundTransition: 'slide'``` to the ```Reveal.initialize()``` call. Alternatively you can set ```data-background-transition``` on any section with a background to override that specific transition. + + +### Slide Transitions The global presentation transition is set using the ```transition``` config value. You can override the global transition for a specific slide by using the ```data-transition``` attribute: ```html @@ -281,6 +305,27 @@ The global presentation transition is set using the ```transition``` config valu Note that this does not work with the page and cube transitions. +### Internal links + +It's easy to link between slides. The first example below targets the index of another slide whereas the second targets a slide with an ID attribute (```<section id="some-slide">```): + +```html +<a href="#/2/2">Link</a> +<a href="#/some-slide">Link</a> +``` + +You can also add relative navigation links, similar to the built in reveal.js controls, by appending one of the following classes on any element. Note that each element is automatically given an ```enabled``` class when it's a valid navigation route based on the current slide. + +```html +<a href="#" class="navigate-left"> +<a href="#" class="navigate-right"> +<a href="#" class="navigate-up"> +<a href="#" class="navigate-down"> +<a href="#" class="navigate-prev"> <!-- Previous vertical or horizontal slide --> +<a href="#" class="navigate-next"> <!-- Next vertical or horizontal slide --> +``` + + ### Fragments Fragments are used to highlight individual elements on a slide. Every element with the class ```fragment``` will be stepped through before moving on to the next slide. Here's an example: http://lab.hakim.se/reveal-js/#/16 @@ -631,4 +676,3 @@ $ grunt serve MIT licensed Copyright (C) 2013 Hakim El Hattab, http://hakim.se - |