diff --git a/.gitignore b/.gitignore
index 9ffdbc7..a5df313 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,6 @@
log/*.log
tmp/**
node_modules/
-.sass-cache
\ No newline at end of file
+.sass-cache
+css/reveal.min.css
+js/reveal.min.js
diff --git a/.travis.yml b/.travis.yml
index 165d9ae..264c6ec 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- - 0.10
+ - 4.1.1
before_script:
- npm install -g grunt-cli
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index fd37e5a..c2091e8 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -4,7 +4,7 @@ Please keep the [issue tracker](http://github.com/hakimel/reveal.js/issues) limi
### Personal Support
-If you have personal support or setup questions the best place to ask those are [StackOverflow](http://stackoverflow.com/questions/tagged/reveal.js).
+If you have personal support or setup questions the best place to ask those are [StackOverflow](http://stackoverflow.com/questions/tagged/reveal.js).
### Bug Reports
@@ -17,4 +17,7 @@ When reporting a bug make sure to include information about which browser and op
- Single-quoted strings
- Should be made towards the **dev branch**
- Should be submitted from a feature/topic branch (not your master)
-- Should not include the minified **reveal.min.js** or **reveal.min.css** files
+
+
+### Plugins
+Please do not submit plugins as pull requests. They should be maintained in their own separate repository. More information here: https://github.com/hakimel/reveal.js/wiki/Plugin-Guidelines
diff --git a/Gruntfile.js b/Gruntfile.js
index 1baf966..a851845 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,6 +1,8 @@
/* global module:false */
module.exports = function(grunt) {
var port = grunt.option('port') || 8000;
+ var base = grunt.option('base') || '.';
+
// Project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
@@ -11,7 +13,7 @@ module.exports = function(grunt) {
' * http://lab.hakim.se/reveal-js\n' +
' * MIT licensed\n' +
' *\n' +
- ' * Copyright (C) 2014 Hakim El Hattab, http://hakim.se\n' +
+ ' * Copyright (C) 2015 Hakim El Hattab, http://hakim.se\n' +
' */'
},
@@ -29,6 +31,31 @@ module.exports = function(grunt) {
}
},
+ sass: {
+ core: {
+ files: {
+ 'css/reveal.css': 'css/reveal.scss',
+ }
+ },
+ themes: {
+ files: [
+ {
+ expand: true,
+ cwd: 'css/theme/source',
+ src: ['*.scss'],
+ dest: 'css/theme',
+ ext: '.css'
+ }
+ ]
+ }
+ },
+
+ autoprefixer: {
+ dist: {
+ src: 'css/reveal.css'
+ }
+ },
+
cssmin: {
compress: {
files: {
@@ -37,22 +64,6 @@ module.exports = function(grunt) {
}
},
- sass: {
- main: {
- files: {
- 'css/theme/default.css': 'css/theme/source/default.scss',
- 'css/theme/beige.css': 'css/theme/source/beige.scss',
- 'css/theme/night.css': 'css/theme/source/night.scss',
- 'css/theme/serif.css': 'css/theme/source/serif.scss',
- 'css/theme/simple.css': 'css/theme/source/simple.scss',
- 'css/theme/sky.css': 'css/theme/source/sky.scss',
- 'css/theme/moon.css': 'css/theme/source/moon.scss',
- 'css/theme/solarized.css': 'css/theme/source/solarized.scss',
- 'css/theme/blood.css': 'css/theme/source/blood.scss'
- }
- }
- },
-
jshint: {
options: {
curly: false,
@@ -70,7 +81,9 @@ module.exports = function(grunt) {
head: false,
module: false,
console: false,
- unescape: false
+ unescape: false,
+ define: false,
+ exports: false
}
},
files: [ 'Gruntfile.js', 'js/reveal.js' ]
@@ -80,7 +93,9 @@ module.exports = function(grunt) {
server: {
options: {
port: port,
- base: '.'
+ base: base,
+ livereload: true,
+ open: true
}
}
},
@@ -97,13 +112,23 @@ module.exports = function(grunt) {
},
watch: {
- main: {
- files: [ 'Gruntfile.js', 'js/reveal.js', 'css/reveal.css' ],
- tasks: 'default'
+ options: {
+ livereload: true
+ },
+ js: {
+ files: [ 'Gruntfile.js', 'js/reveal.js' ],
+ tasks: 'js'
},
theme: {
files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
- tasks: 'themes'
+ tasks: 'css-themes'
+ },
+ css: {
+ files: [ 'css/reveal.scss' ],
+ tasks: 'css-core'
+ },
+ html: {
+ files: [ 'index.html']
}
}
@@ -115,15 +140,25 @@ module.exports = function(grunt) {
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
- grunt.loadNpmTasks( 'grunt-contrib-sass' );
+ grunt.loadNpmTasks( 'grunt-sass' );
grunt.loadNpmTasks( 'grunt-contrib-connect' );
+ grunt.loadNpmTasks( 'grunt-autoprefixer' );
grunt.loadNpmTasks( 'grunt-zip' );
// Default task
- grunt.registerTask( 'default', [ 'jshint', 'cssmin', 'uglify', 'qunit' ] );
+ grunt.registerTask( 'default', [ 'css', 'js' ] );
- // Theme task
- grunt.registerTask( 'themes', [ 'sass' ] );
+ // JS task
+ grunt.registerTask( 'js', [ 'jshint', 'uglify', 'qunit' ] );
+
+ // Theme CSS
+ grunt.registerTask( 'css-themes', [ 'sass:themes' ] );
+
+ // Core framework CSS
+ grunt.registerTask( 'css-core', [ 'sass:core', 'autoprefixer', 'cssmin' ] );
+
+ // All CSS
+ grunt.registerTask( 'css', [ 'sass', 'autoprefixer', 'cssmin' ] );
// Package presentation to archive
grunt.registerTask( 'package', [ 'default', 'zip' ] );
diff --git a/LICENSE b/LICENSE
index 3866d13..0962307 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (C) 2014 Hakim El Hattab, http://hakim.se
+Copyright (C) 2015 Hakim El Hattab, http://hakim.se
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 40d5680..a582549 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
A framework for easily creating beautiful presentations using HTML. [Check out the live demo](http://lab.hakim.se/reveal-js/).
-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.
+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 modern browser but [fallbacks](https://github.com/hakimel/reveal.js/wiki/Browser-Support) are available to make sure your presentation can still be viewed elsewhere.
#### More reading:
@@ -10,10 +10,11 @@ reveal.js comes with a broad range of features including [nested slides](https:/
- [Changelog](https://github.com/hakimel/reveal.js/releases): Up-to-date version history.
- [Examples](https://github.com/hakimel/reveal.js/wiki/Example-Presentations): Presentations created with reveal.js, add your own!
- [Browser Support](https://github.com/hakimel/reveal.js/wiki/Browser-Support): Explanation of browser support and fallbacks.
+- [Plugins](https://github.com/hakimel/reveal.js/wiki/Plugins,-Tools-and-Hardware): A list of plugins that can be used to extend reveal.js.
## Online Editor
-Presentations are written using HTML or markdown but there's also an online editor for those of you who prefer a graphical interface. Give it a try at [http://slid.es](http://slid.es).
+Presentations are written using HTML or Markdown but there's also an online editor for those of you who prefer a graphical interface. Give it a try at [http://slides.com](http://slides.com).
## Instructions
@@ -59,8 +60,8 @@ When used locally, this feature requires that reveal.js [runs from a local web s
```html
```
@@ -136,6 +137,13 @@ Reveal.initialize({
// 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
@@ -154,13 +162,13 @@ Reveal.initialize({
previewLinks: false,
// Transition style
- transition: 'default', // default/cube/page/concave/zoom/linear/fade/none
+ transition: 'default', // none/fade/slide/convex/concave/zoom
// Transition speed
transitionSpeed: 'default', // default/fast/slow
// Transition style for full page slide backgrounds
- backgroundTransition: 'default', // default/none/slide/concave/convex/zoom
+ backgroundTransition: 'default', // none/fade/slide/convex/concave/zoom
// Number of slides away from the current that are visible
viewDistance: 3,
@@ -169,14 +177,16 @@ Reveal.initialize({
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"
+ parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px"
+ // Amount to move parallax background (horizontal and vertical) on slide change
+ // Number, e.g. 100
+ parallaxBackgroundHorizontal: '',
+ parallaxBackgroundVertical: ''
});
```
-Note that the new default vertical centering option will break compatibility with slides that were using transitions with backgrounds (`cube` and `page`). To restore the previous behavior, set `center` to `false`.
-
The configuration can be updated after initialization using the ```configure``` method:
@@ -207,13 +217,13 @@ Reveal.initialize({
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
// Zoom in and out with Alt+click
- { src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
+ { src: 'plugin/zoom-js/zoom.js', async: true },
// Speaker notes
- { src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
+ { src: 'plugin/notes/notes.js', async: true },
// Remote control your reveal.js presentation using a touch device
- { src: 'plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } },
+ { src: 'plugin/remotes/remotes.js', async: true },
// MathJax
{ src: 'plugin/math/math.js', async: true }
@@ -228,6 +238,17 @@ 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
+### Ready Event
+
+A 'ready' event is fired when reveal.js has loaded all non-async dependencies and is ready to start navigating. To check if reveal.js is already 'ready' you can call `Reveal.isReady()`.
+
+```javascript
+Reveal.addEventListener( 'ready', function( event ) {
+ // event.currentSlide, event.indexh, event.indexv
+} );
+```
+
+
### 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.
@@ -250,7 +271,7 @@ Reveal.initialize({
// Bounds for smallest/largest possible scale to apply to content
minScale: 0.2,
- maxScale: 1.0
+ maxScale: 1.5
});
```
@@ -258,7 +279,7 @@ Reveal.initialize({
### Auto-sliding
-Presentations can be configure 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:
+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:
```javascript
// Slide every five seconds
@@ -266,15 +287,20 @@ Reveal.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.
-When this is turned on a control element will appear that enables users to pause and resume auto-sliding. Sliding is also 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 by using the ```data-autoslide``` attribute on individual sections:
+You can also override the slide duration for individual slides and fragments by using the ```data-autoslide``` attribute:
```html
-This will remain on screen for 10 seconds
+
+
After 2 seconds the first fragment will be shown.
+
After 10 seconds the next fragment will be shown.
+
Now, the fragment is displayed for 2 seconds before the next slide is shown.
+
```
+Whenever the auto-slide mode is resumed or paused the ```autoslideresumed``` and ```autoslidepaused``` events are fired.
+
### Keyboard Bindings
@@ -290,10 +316,34 @@ Reveal.configure({
});
```
+### 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.
+
+```html
+
+
+
+
+
+```
+
### API
-The ``Reveal`` class provides a JavaScript API for controlling navigation and reading state:
+The ``Reveal`` object exposes a JavaScript API for controlling navigation and reading state:
```javascript
// Navigation
@@ -306,35 +356,43 @@ Reveal.prev();
Reveal.next();
Reveal.prevFragment();
Reveal.nextFragment();
+
+// Toggle presentation states, optionally pass true/false to force on/off
Reveal.toggleOverview();
Reveal.togglePause();
+Reveal.toggleAutoSlide();
+
+// Change a config value at runtime
+Reveal.configure({ controls: true });
+
+// Returns the present configuration options
+Reveal.getConfig();
+
+// Fetch the current scale of the presentation
+Reveal.getScale();
// Retrieves the previous and current slide elements
Reveal.getPreviousSlide();
Reveal.getCurrentSlide();
Reveal.getIndices(); // { h: 0, v: 0 } }
+Reveal.getProgress(); // 0-1
+Reveal.getTotalSlides();
+
+// Returns the speaker notes for the current slide
+Reveal.getSlideNotes();
// State checks
Reveal.isFirstSlide();
Reveal.isLastSlide();
Reveal.isOverview();
Reveal.isPaused();
-```
-
-### Ready Event
-
-The 'ready' event is fired when reveal.js has loaded all (synchronous) dependencies and is ready to start navigating.
-
-```javascript
-Reveal.addEventListener( 'ready', function( event ) {
- // event.currentSlide, event.indexh, event.indexv
-} );
+Reveal.isAutoSliding();
```
### 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.
+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](https://github.com/hakimel/reveal.js/issues/226#issuecomment-10261609)), 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.
@@ -344,8 +402,24 @@ Reveal.addEventListener( 'slidechanged', function( event ) {
} );
```
+### Presentation State
-### States
+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.
+
+```javascript
+Reveal.slide( 1 );
+// we're on slide 1
+
+var state = Reveal.getState();
+
+Reveal.slide( 3 );
+// we're on slide 3
+
+Reveal.setState( state );
+// we're back on slide 1
+```
+
+### Slide 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.
@@ -359,7 +433,7 @@ Reveal.addEventListener( 'somestate', function() {
### 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.
+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 `````` elements. Four different types of backgrounds are supported: color, image, video and iframe. Below are a few examples.
```html
@@ -371,6 +445,12 @@ Slides are contained within a limited portion of the screen by default to allow
This background image will be sized to 100px and repeated.
+
+
Video. Multiple sources can be defined using a comma separated list. Video will loop when the data-background-video-loop attribute is provided.
+
+
+
Embeds a web page as a background. Note that the page won't be interactive.
+
```
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.
@@ -378,7 +458,7 @@ Backgrounds transition using a fade animation by default. This can be changed to
### Parallax Background
-If you want to use a parallax scrolling background, set the two following config properties when initializing reveal.js (the third one is optional).
+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).
```javascript
Reveal.initialize({
@@ -389,8 +469,11 @@ Reveal.initialize({
// Parallax background size
parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px" - currently only pixels are supported (don't use % or auto)
- // This slide transition gives best results:
- transition: linear
+ // Amount of pixels to move the parallax background per slide step,
+ // a value of 0 disables movement along the given axis
+ // These are optional, if they aren't specified they'll be calculated automatically
+ parallaxBackgroundHorizontal: 200,
+ parallaxBackgroundVertical: 50
});
```
@@ -412,6 +495,27 @@ The global presentation transition is set using the ```transition``` config valu
```
+You can also use different in and out transitions for the same slide:
+
+```html
+
+ The train goes on …
+
+
+ and on …
+
+
+ and stops.
+
+
+ (Passengers entering and leaving)
+
+
+ And it starts again.
+
+```
+
+
Note that this does not work with the page and cube transitions.
@@ -445,7 +549,6 @@ The default fragment style is to start out invisible and fade in. This style can
- Not a coder? No problem. There's a fully-featured visual editor for authoring these, try it out at http://slid.es.
+ Not a coder? Not a problem. There's a fully-featured visual editor for authoring these, try it out at http://slides.com.
@@ -112,14 +98,153 @@
-
Works in Mobile Safari
+
Touch Optimized
- Try it out! You can swipe through the slides and pinch your way to the overview.
+ Presentations look great on touch devices, like mobile phones and tablets. Simply swipe through your slides.
+
-
- * Theme demos are loaded after the presentation which leads to flicker. In production you should load your theme in the <head> using a <link>.
-
-
-
-
-
Global State
-
- Set data-state="something" on a slide and "something"
- will be added as a class to the document element when the slide is open. This lets you
- apply broader style changes, like switching the background.
-
-
-
-
-
Custom Events
-
- Additionally custom events can be triggered on a per slide basis by binding to the data-state name.
-
+ Set data-state="something" on a slide and "something"
+ will be added as a class to the document element when the slide is open. This lets you
+ apply broader style changes, like switching the page background.
+
+
+
+
+
State Events
+
+ Additionally custom events can be triggered on a per slide basis by binding to the data-state name.
+
- Press b or period on your keyboard to enter the 'paused' mode. This mode is helpful when you want to take distracting slides off the screen
- during a presentation.
+ Press B or . on your keyboard to pause the presentation. This is helpful when you're on stage and want to take distracting slides off the screen.