From b645828707cd9752055f2e2c237f977207c4ea73 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 19 Dec 2018 11:04:29 +0100 Subject: ensure history api is available, default to hash: true with no history in demo #2286 --- js/reveal.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/reveal.js b/js/reveal.js index afbc35a..f3f4ae1 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -76,12 +76,13 @@ // Determine which displays to show the slide number on showSlideNumber: 'all', + // Add the current slide number to the URL hash so that reloading the + // page/copying the URL will return you to the same slide + hash: false, + // 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, @@ -4148,10 +4149,10 @@ writeURLTimeout = setTimeout( writeURL, delay ); } else if( currentSlide ) { - if ( config.history ) { + if( config.history || !window.history ) { window.location.hash = locationHash(); } - else if ( config.hash ) { + else if( config.hash ) { window.history.replaceState(null, null, '#' + locationHash()); } } -- cgit v1.2.3