rc-web@42: # reveal.js rc-web@42: rc-web@42: A framework for easily creating beautiful presentations using HTML. [Check out the live demo](http://lab.hakim.se/reveal-js/). rc-web@42: rc-web@42: reveal.js comes with a broad range of features including [nested slides](https://github.com/hakimel/reveal.js#markup), [markdown contents](https://github.com/hakimel/reveal.js#markdown), [PDF export](https://github.com/hakimel/reveal.js#pdf-export), [speaker notes](https://github.com/hakimel/reveal.js#speaker-notes) and a [JavaScript API](https://github.com/hakimel/reveal.js#api). It's best viewed in a browser with support for CSS 3D transforms but [fallbacks](https://github.com/hakimel/reveal.js/wiki/Browser-Support) are available to make sure your presentation can still be viewed elsewhere. rc-web@42: rc-web@42: rc-web@42: #### More reading in the Wiki: rc-web@42: - [Changelog](https://github.com/hakimel/reveal.js/wiki/Changelog): Up-to-date version history. rc-web@42: - [Examples](https://github.com/hakimel/reveal.js/wiki/Example-Presentations): Presentations created with reveal.js, add your own! rc-web@42: - [Browser Support](https://github.com/hakimel/reveal.js/wiki/Changelog): Explanation of browser support and fallbacks. rc-web@42: rc-web@42: rc-web@42: ## Instructions rc-web@42: rc-web@42: ### Markup rc-web@42: rc-web@42: Markup heirarchy needs to be ``
`` where the ``
`` represents one slide and can be repeated indefinitely. If you place multiple ``
``'s inside of another ``
`` they will be shown as vertical slides. The first of the vertical slides is the "root" of the others (at the top), and it will be included in the horizontal sequence. For example: rc-web@42: rc-web@42: ```html rc-web@42:
rc-web@42:
rc-web@42:
Single Horizontal Slide
rc-web@42:
rc-web@42:
Vertical Slide 1
rc-web@42:
Vertical Slide 2
rc-web@42:
rc-web@42:
rc-web@42:
rc-web@42: ``` rc-web@42: rc-web@42: ### Markdown rc-web@42: rc-web@42: It's possible to write your slides using Markdown. To enable Markdown simply add the ```data-markdown``` attribute to your ```
``` elements and reveal.js will automatically load the JavaScript parser. rc-web@42: rc-web@42: This is based on [data-markdown](https://gist.github.com/1343518) from [Paul Irish](https://github.com/paulirish) which in turn uses [showdown](https://github.com/coreyti/showdown/). This is sensitive to indentation (avoid mixing tabs and spaces) and line breaks (avoid consecutive breaks). Updates to come. rc-web@42: rc-web@42: ```html rc-web@42:
rc-web@42: ## Page title rc-web@42: rc-web@42: A paragraph with some text and a [link](http://hakim.se). rc-web@42:
rc-web@42: ``` rc-web@42: rc-web@42: rc-web@42: ### Configuration rc-web@42: rc-web@42: At the end of your page you need to initialize reveal by running the following code. Note that all config values are optional and will default as specified below. rc-web@42: rc-web@42: ```javascript rc-web@42: Reveal.initialize({ rc-web@42: // Display controls in the bottom right corner rc-web@42: controls: true, rc-web@42: rc-web@42: // Display a presentation progress bar rc-web@42: progress: true, rc-web@42: rc-web@42: // Push each slide change to the browser history rc-web@42: history: false, rc-web@42: rc-web@42: // Enable keyboard shortcuts for navigation rc-web@42: keyboard: true, rc-web@42: rc-web@42: // Loop the presentation rc-web@42: loop: false, rc-web@42: rc-web@42: // Number of milliseconds between automatically proceeding to the rc-web@42: // next slide, disabled when set to 0 rc-web@42: autoSlide: 0, rc-web@42: rc-web@42: // Enable slide navigation via mouse wheel rc-web@42: mouseWheel: true, rc-web@42: rc-web@42: // Apply a 3D roll to links on hover rc-web@42: rollingLinks: true, rc-web@42: rc-web@42: // Transition style rc-web@42: transition: 'default' // default/cube/page/concave/linear(2d) rc-web@42: }); rc-web@42: ``` rc-web@42: rc-web@42: ### Dependencies rc-web@42: rc-web@42: 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: rc-web@42: rc-web@42: ```javascript rc-web@42: Reveal.initialize({ rc-web@42: dependencies: [ rc-web@42: // Syntax highlight for elements rc-web@42: { src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } }, rc-web@42: // Cross-browser shim that fully implements classList - https://github.com/eligrey/classList.js/ rc-web@42: { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } } rc-web@42: // Interpret Markdown in
elements rc-web@42: { src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, rc-web@42: { src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, rc-web@42: // Speaker notes support rc-web@42: { src: 'plugin/speakernotes/client.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } }, rc-web@42: { src: 'socket.io/socket.io.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } }, rc-web@42: ] rc-web@42: }); rc-web@42: ``` rc-web@42: rc-web@42: You can add your own extensions using the same syntax. The following properties are available for each dependency object: rc-web@42: - **src**: Path to the script to load rc-web@42: - **async**: [optional] Flags if the script should load after reveal.js has started, defaults to false rc-web@42: - **callback**: [optional] Function to execute when the script has loaded rc-web@42: - **condition**: [optional] Function which must return true for the script to be loaded rc-web@42: rc-web@42: rc-web@42: ### API rc-web@42: rc-web@42: The Reveal class provides a minimal JavaScript API for controlling navigation and reading state: rc-web@42: rc-web@42: ```javascript rc-web@42: // Navigation rc-web@42: Reveal.navigateTo( indexh, indexv ); rc-web@42: Reveal.navigateLeft(); rc-web@42: Reveal.navigateRight(); rc-web@42: Reveal.navigateUp(); rc-web@42: Reveal.navigateDown(); rc-web@42: Reveal.navigatePrev(); rc-web@42: Reveal.navigateNext(); rc-web@42: Reveal.toggleOverview(); rc-web@42: rc-web@42: // Retrieves the previous and current slide elements rc-web@42: Reveal.getPreviousSlide(); rc-web@42: Reveal.getCurrentSlide(); rc-web@42: rc-web@42: Reveal.getIndices(); // { h: 0, v: 0 } } rc-web@42: ``` rc-web@42: rc-web@42: ### States rc-web@42: rc-web@42: 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. rc-web@42: rc-web@42: Furthermore you can also listen to these changes in state via JavaScript: rc-web@42: rc-web@42: ```javascript rc-web@42: Reveal.addEventListener( 'somestate', function() { rc-web@42: // TODO: Sprinkle magic rc-web@42: }, false ); rc-web@42: ``` rc-web@42: rc-web@42: ### Slide change event rc-web@42: rc-web@42: 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. rc-web@42: rc-web@42: ```javascript rc-web@42: Reveal.addEventListener( 'slidechanged', function( event ) { rc-web@42: // event.previousSlide, event.currentSlide, event.indexh, event.indexv rc-web@42: } ); rc-web@42: ``` rc-web@42: rc-web@42: ### Fragment events rc-web@42: rc-web@42: When a slide fragment is either shown or hidden reveal.js will dispatch an event. rc-web@42: rc-web@42: ```javascript rc-web@42: Reveal.addEventListener( 'fragmentshown', function( event ) { rc-web@42: // event.fragment = the fragment DOM element rc-web@42: } ); rc-web@42: Reveal.addEventListener( 'fragmenthidden', function( event ) { rc-web@42: // event.fragment = the fragment DOM element rc-web@42: } ); rc-web@42: ``` rc-web@42: rc-web@42: ### Internal links rc-web@42: rc-web@42: 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 (```
```): rc-web@42: rc-web@42: ```html rc-web@42: Link rc-web@42: Link rc-web@42: ``` rc-web@42: rc-web@42: ## PDF Export rc-web@42: rc-web@42: Presentations can be exported to PDF via a special print stylesheet. This feature requires that you use [Google Chrome](http://google.com/chrome). rc-web@42: Here's an example of an exported presentation that's been uploaded to SlideShare: http://www.slideshare.net/hakimel/revealjs-13872948. rc-web@42: rc-web@42: 1. Open the desired presentation with *print-pdf* anywhere in the query, for example: [lab.hakim.se/reveal-js?print-pdf](http://lab.hakim.se/reveal-js?print-pdf) rc-web@42: 2. Open the in-browser print dialog (CMD+P). rc-web@42: 3. Change the **Destination** setting to **Save as PDF**. rc-web@42: 4. Change the **Layout** to **Landscape**. rc-web@42: 5. Change the **Margins** to **None**. rc-web@42: 6. Click **Save**. rc-web@42: rc-web@42: ![Chrome Print Settings](https://s3.amazonaws.com/hakim-static/reveal-js/pdf-print-settings.png) rc-web@42: rc-web@42: ## Speaker Notes rc-web@42: rc-web@42: If you're interested in using speaker notes, reveal.js comes with a Node server that allows you to deliver your presentation in one browser while viewing speaker notes in another. rc-web@42: rc-web@42: To include speaker notes in your presentation, simply add an `