aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--js/reveal.js25
2 files changed, 19 insertions, 11 deletions
diff --git a/README.md b/README.md
index d8960b1..e32478a 100644
--- a/README.md
+++ b/README.md
@@ -259,9 +259,12 @@ Reveal.initialize({
// Display the page number of the current slide
slideNumber: false,
- // Push each slide change to the browser history
+ // Push each slide change to the browser history. Implies `hash: true`
history: false,
+ // Change the hash when changing slides -- impacts browser history with `history: true`
+ hash: false,
+
// Enable keyboard shortcuts for navigation
keyboard: true,
diff --git a/js/reveal.js b/js/reveal.js
index 637ea63..c9f3b3b 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -76,9 +76,12 @@
// Determine which displays to show the slide number on
showSlideNumber: 'all',
- // Push each slide change to the browser history
+ // Push each slide change to the browser history. Implies `hash: true`
history: false,
+ // Change the hash when changing slides -- impacts browser history with `history: true`
+ hash: false,
+
// Enable keyboard shortcuts for navigation
keyboard: true,
@@ -4114,18 +4117,20 @@
*/
function writeURL( delay ) {
- if( config.history ) {
-
- // Make sure there's never more than one timeout running
- clearTimeout( writeURLTimeout );
+ // Make sure there's never more than one timeout running
+ clearTimeout( writeURLTimeout );
- // If a delay is specified, timeout this call
- if( typeof delay === 'number' ) {
- writeURLTimeout = setTimeout( writeURL, delay );
- }
- else if( currentSlide ) {
+ // If a delay is specified, timeout this call
+ if( typeof delay === 'number' ) {
+ writeURLTimeout = setTimeout( writeURL, delay );
+ }
+ else if( currentSlide ) {
+ if ( config.history ) {
window.location.hash = locationHash();
}
+ else if ( config.hash ) {
+ window.history.replaceState(null, null, '#' + locationHash());
+ }
}
}