Fix nested if-statement in readURL that caused slide(h,v) to be

called even when the current slide is the target slide.
This commit is contained in:
Mario Botsch 2018-10-24 23:22:11 +02:00
parent 7d66999c7f
commit 8a35a1e1ed
1 changed files with 7 additions and 4 deletions

View File

@ -4070,11 +4070,14 @@
// Ensure that we're not already on a slide with the same name // Ensure that we're not already on a slide with the same name
var isSameNameAsCurrentSlide = currentSlide ? currentSlide.getAttribute( 'id' ) === name : false; var isSameNameAsCurrentSlide = currentSlide ? currentSlide.getAttribute( 'id' ) === name : false;
if( element && !isSameNameAsCurrentSlide ) { if( element ) {
// Find the position of the named slide and navigate to it // If the slide exists and is not the current slide...
if ( !isSameNameAsCurrentSlide ) {
// ...find the position of the named slide and navigate to it
var indices = Reveal.getIndices(element); var indices = Reveal.getIndices(element);
slide(indices.h, indices.v); slide(indices.h, indices.v);
} }
}
// If the slide doesn't exist, navigate to the current slide // If the slide doesn't exist, navigate to the current slide
else { else {
slide( indexh || 0, indexv || 0 ); slide( indexh || 0, indexv || 0 );