From 8aede28699829edd5f8ef7a1c4fab61ad41c5220 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 18 Jun 2013 10:22:47 -0300 Subject: [PATCH] readme restructure, add keyboard section --- README.md | 126 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 2c0ae5f..96b7c0e 100644 --- a/README.md +++ b/README.md @@ -126,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: @@ -190,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 @@ -221,7 +235,7 @@ 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. @@ -231,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. @@ -243,7 +257,20 @@ Reveal.addEventListener( 'slidechanged', function( event ) { } ); ``` -### Slide backgrounds + +### States + +If you set ``data-state="somestate"`` on a slide ``
``, "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 ); +``` + +### 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 ```
``` elements. Below are a few examples. @@ -262,18 +289,21 @@ Slides are contained within a limited portion of the screen by default to allow 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. -### States - -If you set ``data-state="somestate"`` on a slide ``
``, "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. +### 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: -Furthermore you can also listen to these changes in state via JavaScript: +```html +
+

This slide will override the presentation transition and zoom!

+
-```javascript -Reveal.addEventListener( 'somestate', function() { - // TODO: Sprinkle magic -}, false ); +
+

Choose from three transition speeds: default, fast or slow!

+
``` +Note that this does not work with the page and cube transitions. + ### Internal links @@ -295,21 +325,6 @@ You can also add relative navigation links, similar to the built in reveal.js co ``` -### Alternating 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 -
-

This slide will override the presentation transition and zoom!

-
- -
-

Choose from three transition speeds: default, fast or slow!

-
-``` - -Note that this does not work with the page and cube transitions. - ### 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 @@ -661,4 +676,3 @@ $ grunt serve MIT licensed Copyright (C) 2013 Hakim El Hattab, http://hakim.se - -- 2.26.2