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 ``
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: 
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 `