The presentation markup hierarchy needs to be .reveal > .slides > section where the section represents one slide and can be repeated indefinitely. If you place multiple section elements inside of another section they will be shown as vertical slides. The first of the vertical slides is the "root" of the others (at the top), and will be included in the horizontal sequence. For example:

Markdown

It's possible to write your slides using Markdown. To enable Markdown, add the data-markdown attribute to your <section> elements and wrap the contents in a <script type="text/template"> like the example below.

<sectiondata-markdown>
<scripttype="text/template">
## Page title
A paragraph with some text and a [link](http://hakim.se).
</script>
</section>

External Markdown

You can write your content as a separate file and have reveal.js load it at runtime. Note the separator arguments which determine how slides are delimited in the external file. The data-charset attribute is optional and specifies which charset to use when loading the external file.

Configuration

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.

Reveal.initialize({
// Display controls in the bottom right corner
controls:true,
// Display a presentation progress bar
progress:true,
// Display the page number of the current slide
slideNumber:false,
// Push each slide change to the browser history
history:false,
// Enable keyboard shortcuts for navigation
keyboard:true,
// Enable the slide overview mode
overview:true,
// Vertical centering of slides
center:true,
// Enables touch navigation on devices with touch input
touch:true,
// Loop the presentation
loop:false,
// Change the presentation direction to be RTL
rtl:false,
// Randomizes the order of slides each time the presentation loads
shuffle:false,
// Turns fragments on and off globally
fragments:true,
// Flags if the presentation is running in an embedded mode,// i.e. contained within a limited portion of the screen
embedded:false,
// Flags if we should show a help overlay when the questionmark// key is pressed
help:true,
// Flags if speaker notes should be visible to all viewers
showNotes:false,
// Number of milliseconds between automatically proceeding to the// next slide, disabled when set to 0, this value can be overwritten// by using a data-autoslide attribute on your slides
autoSlide:0,
// Stop auto-sliding after user input
autoSlideStoppable:true,
// Use this method for navigation when auto-sliding
autoSlideMethod:Reveal.navigateNext,
// Enable slide navigation via mouse wheel
mouseWheel:false,
// Hides the address bar on mobile devices
hideAddressBar:true,
// Opens links in an iframe preview overlay
previewLinks:false,
// Transition style
transition:'default', // none/fade/slide/convex/concave/zoom// Transition speed
transitionSpeed:'default', // default/fast/slow// Transition style for full page slide backgrounds
backgroundTransition:'default', // none/fade/slide/convex/concave/zoom// Number of slides away from the current that are visible
viewDistance:3,
// 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"// Number of pixels to move the parallax background per slide// - Calculated automatically unless specified// - Set to 0 to disable movement along an axis
parallaxBackgroundHorizontal:null,
parallaxBackgroundVertical:null
});

The configuration can be updated after initialization using the configure method:

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:

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.5
});

If you wish to disable this behavior and do your own scaling (e.g. using media queries), try these settings:

Auto-sliding

Presentations can be configured to progress through slides automatically, without any user input. To enable this you will need to tell the framework how many milliseconds it should wait between slides:

// Slide every five secondsReveal.configure({
autoSlide:5000
});

When this is turned on a control element will appear that enables users to pause and resume auto-sliding. Alternatively, sliding can be paused or resumed by pressing »a« on the keyboard. Sliding is paused automatically as soon as the user starts navigating. You can disable these controls by specifying autoSlideStoppable: false in your reveal.js config.

You can also override the slide duration for individual slides and fragments by using the data-autoslide attribute:

<sectiondata-autoslide="2000">
<p>After 2 seconds the first fragment will be shown.</p>
<pclass="fragment"data-autoslide="10000">After 10 seconds the next fragment will be shown.</p>
<pclass="fragment">Now, the fragment is displayed for 2 seconds before the next slide is shown.</p>
</section>

To override the method used for navigation when auto-sliding, you can specify the autoSlideMethod setting. To only navigate along the top layer and ignore vertical slides, set this to Reveal.navigateRight.

Whenever the auto-slide mode is resumed or paused the autoslideresumed and autoslidepaused events are fired.

Keyboard Bindings

If you're unhappy with any of the default keyboard bindings you can override them using the keyboard config option:

Reveal.configure({
keyboard: {
13:'next', // go to the next slide when the ENTER key is pressed27:function() {}, // do something custom when ESC is pressed32:null// don't do anything when SPACE is pressed (i.e. disable a reveal.js default binding)
}
});

Touch Navigation

You can swipe to navigate through a presentation on any touch-enabled device. Horizontal swipes change between horizontal slides, vertical swipes change between vertical slides. If you wish to disable this you can set the touch config option to false when initializing reveal.js.

If there's some part of your content that needs to remain accessible to touch events you'll need to highlight this by adding a data-prevent-swipe attribute to the element. One common example where this is useful is elements that need to be scrolled.

Lazy Loading

When working on presentation with a lot of media or iframe content it's important to load lazily. Lazy loading means that reveal.js will only load content for the few slides nearest to the current slide. The number of slides that are preloaded is determined by the viewDistance configuration option.

To enable lazy loading all you need to do is change your "src" attributes to "data-src" as shown below. This is supported for image, video, audio and iframe elements. Lazy loaded iframes will also unload when the containing slide is no longer visible.

Slide Changed Event

A '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.

Some libraries, like MathJax (see #226), get confused by the transforms and display states of slides. Often times, this can be fixed by calling their update or render function from this callback.

Presentation State

The presentation's current state can be fetched by using the getState method. A state object contains all of the information required to put the presentation back as it was when getState was first called. Sort of like a snapshot. It's a simple object that can easily be stringified and persisted or sent over the wire.

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

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 backgrounds outside of the slide area by adding a data-background attribute to your <section> elements. Four different types of backgrounds are supported: color, image, video and iframe.

Color Backgrounds

All CSS color formats are supported, like rgba() or hsl().

<sectiondata-background-color="#ff0000">
<h2>Color</h2>
</section>

Image Backgrounds

By default, background images are resized to cover the full page. Available options:

Background 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.

Parallax Background

If you want to use a parallax scrolling background, set the first two config properties below when initializing reveal.js (the other two are optional).

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">):

<ahref="#/2/2">Link</a>
<ahref="#/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.

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/#/fragments

The default fragment style is to start out invisible and fade in. This style can be changed by appending a different class to the fragment:

Code syntax highlighting

By default, Reveal is configured with highlight.js for code syntax highlighting. Below is an example with clojure code that will be syntax highlighted. When the data-trim attribute is present, surrounding whitespace is automatically removed. HTML will be escaped by default. To avoid this, for example if you are using <mark> to call out a line of code, add the data-noescape attribute to the <code> element.

Overview mode

Press "Esc" or "o" keys to toggle the overview mode on and off. While you're in this mode, you can still navigate between slides,
as if you were at 1,000 feet above your presentation. The overview mode comes with a few API hooks:

Additionally the framework automatically pushes two post messages to all iframes, slide:start when the slide containing the iframe is made visible and slide:stop when it is hidden.

Stretching elements

Sometimes it's desirable to have an element, like an image or video, stretch to consume as much space as possible within a given slide. This can be done by adding the .stretch class to an element as seen below:

<section>
<h2>This video will use up the remaining space on the slide</h2>
<videoclass="stretch"src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"></video>
</section>

Limitations:

Only direct descendants of a slide section can be stretched

Only one descendant per slide section can be stretched

postMessage API

The framework has a built-in postMessage API that can be used when communicating with a presentation inside of another window. Here's an example showing how you'd make a reveal.js instance in the given window proceed to slide 2:

When reveal.js runs inside of an iframe it can optionally bubble all of its events to the parent. Bubbled events are stringified JSON with three fields: namespace, eventName and state. Here's how you subscribe to them from the parent window:

Speaker Notes

reveal.js comes with a speaker notes plugin which can be used to present per-slide notes in a separate browser window. The notes window also gives you a preview of the next upcoming slide so it may be helpful even if you haven't written any notes. Press the 's' key on your keyboard to open the notes window.

Notes are defined by appending an <aside> element to a slide as seen below. You can add the data-markdown attribute to the aside element if you prefer writing notes using Markdown.

Alternatively you can add your notes in a data-notes attribute on the slide. Like <section data-notes="Something important"></section>.

<section>
<h2>Some Slide</h2>
<asideclass="notes">
Oh hey, these are some notes. They'll be hidden in your presentation, but you can see them if you open the speaker notes window (hit 's' on your keyboard).
</aside>
</section>

If you're using the external Markdown plugin, you can add notes with the help of a special delimiter:

<sectiondata-markdown="example.md"data-separator="^\n\n\n"data-separator-vertical="^\n\n"data-separator-notes="^Note:"></section>
# Title
## Sub-title
Here is some content...
Note:
This will only display in the notes window.

Share and Print Speaker Notes

Notes are only visible to the speaker inside of the speaker view. If you wish to share your notes with others you can initialize reveal.js with the showNotes config value set to true. Notes will appear along the bottom of the presentations.

When showNotes is enabled notes are also included when you export to PDF.

Server Side Speaker Notes

In some cases it can be desirable to run notes on a separate device from the one you're presenting on. The Node.js-based notes plugin lets you do this using the same note definitions as its client side counterpart. Include the required scripts by adding the following dependencies:

Multiplexing

The multiplex plugin allows your audience to view the slides of the presentation you are controlling on their own phone, tablet or laptop. As the master presentation navigates the slides, all client presentations will update in real time. See a demo at https://reveal-js-multiplex-ccjbegmaii.now.sh/.

The multiplex plugin needs the following 3 things to operate:

Master presentation that has control

Client presentations that follow the master

Socket.io server to broadcast events from the master to the clients

More details:

Master presentation

Served from a static file server accessible (preferably) only to the presenter. This need only be on your (the presenter's) computer. (It's safer to run the master presentation from your own computer, so if the venue's Internet goes down it doesn't stop the show.) An example would be to execute the following commands in the directory of your master presentation:

npm install node-static

static

If you want to use the speaker notes plugin with your master presentation then make sure you have the speaker notes plugin configured correctly along with the configuration shown below, then execute node plugin/notes-server in the directory of your master presentation. The configuration below will cause it to connect to the socket.io server as a master, as well as launch your speaker-notes/static-file server.

Client presentation

Served from a publicly accessible static file server. Examples include: GitHub Pages, Amazon S3, Dreamhost, Akamai, etc. The more reliable, the better. Your audience can then access the client presentation via http://example.com/path/to/presentation/client/index.html, with the configuration below causing them to connect to the socket.io server as clients.

Socket.io server

Server that receives the slideChanged events from the master presentation and broadcasts them out to the connected client presentations. This needs to be publicly accessible. You can run your own socket.io server with the commands:

You are very welcome to point your presentations at the Socket.io server running at https://reveal-js-multiplex-ccjbegmaii.now.sh/, but availability and stability are not guaranteed. For anything mission critical I recommend you run your own server. It is simple to deploy to nodejitsu, heroku, your own environment, etc.

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/ 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. ;)

MathJax

If you want to display math equations in your presentation you can easily do so by including this plugin. The plugin is a very thin wrapper around the MathJax library. To use it you'll need to include it as a reveal.js dependency, find our more about dependencies here.

The plugin defaults to using LaTeX but that can be adjusted through the math configuration object. Note that MathJax is loaded from a remote server. If you want to use it offline you'll need to download a copy of the library and adjust the mathjax configuration value.

Below is an example of how the plugin can be configured. If you don't intend to change these values you do not need to include the math config object at all.

Installation

The basic setup is for authoring presentations only. The full setup gives you access to all reveal.js features and plugins such as speaker notes as well as the development tasks needed to make changes to the source.

Basic setup

The core of reveal.js is very easy to install. You'll simply need to download a copy of this repository and open the index.html file directly in your browser.

Full setup

Some reveal.js features, like external Markdown and speaker notes, require that presentations run from a local web server. The following instructions will set up such a server as well as all of the development tasks needed to make edits to the reveal.js source code.