From 397feab8b4be5f8445ebb05808b507248188d4fe Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 27 Mar 2018 14:21:41 +0200 Subject: [PATCH] gracefully handle duplicate slide id's --- js/reveal.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/reveal.js b/js/reveal.js index c6d05d5d..2d85b89d 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -3781,7 +3781,10 @@ } catch ( error ) { } - if( element ) { + // Ensure that we're not already on a slide with the same name + var isSameNameAsCurrentSlide = currentSlide ? currentSlide.getAttribute( 'id' ) === name : false; + + if( element && !isSameNameAsCurrentSlide ) { // Find the position of the named slide and navigate to it var indices = Reveal.getIndices( element ); slide( indices.h, indices.v );