aboutsummaryrefslogtreecommitdiff
path: root/js/reveal.js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2012-11-10 14:48:29 -0500
committerHakim El Hattab <hakim.elhattab@gmail.com>2012-11-10 14:48:29 -0500
commitb4815a3a831cab4775b18b9e78711d25a7531f51 (patch)
tree58037ba552ed60b26bc341c8024697bc3b38ce76 /js/reveal.js
parenteac5a3a2399aa57b976d41050bf9690535c2be85 (diff)
downloadfosdem-2018-presentation-b4815a3a831cab4775b18b9e78711d25a7531f51.tar
fosdem-2018-presentation-b4815a3a831cab4775b18b9e78711d25a7531f51.tar.gz
remember last visited vertical slide (closes #225)
Diffstat (limited to 'js/reveal.js')
-rw-r--r--js/reveal.js33
1 files changed, 25 insertions, 8 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 6f527d4..6f9388d 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -1,5 +1,5 @@
/*!
- * reveal.js 2.2 r41
+ * reveal.js 2.2 r42
* http://lab.hakim.se/reveal-js
* MIT licensed
*
@@ -500,6 +500,11 @@ var Reveal = (function(){
for( var i = 0, len = slides.length; i < len; i++ ) {
var slide = slides[ i ];
+ // Don't bother update invisible slides
+ if( slide.style.display === 'none' ) {
+ continue;
+ }
+
// Vertical stacks are not centered since their section
// children will be
if( slide.classList.contains( 'stack' ) ) {
@@ -696,6 +701,21 @@ var Reveal = (function(){
// Remember where we were at before
previousSlide = currentSlide;
+ // Query all horizontal slides in the deck
+ var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR );
+
+ // If no vertical index is specified and the upcoming slide is a
+ // stack, resume at its previous vertical index
+ if( v === undefined && horizontalSlides[ h ] && horizontalSlides[ h ].classList.contains( 'stack' ) ) {
+ v = parseInt( horizontalSlides[ h ].getAttribute( 'data-previous-indexv' ) || 0 );
+ }
+
+ // If we were on a vertical stack, remember what vertical index
+ // it was on so we can resume at the same position when returning
+ if( previousSlide && previousSlide.parentNode.classList.contains( 'stack' ) ) {
+ previousSlide.parentNode.setAttribute( 'data-previous-indexv', indexv );
+ }
+
// Remember the state before this slide
var stateBefore = state.concat();
@@ -743,9 +763,6 @@ var Reveal = (function(){
clearTimeout( writeURLTimeout );
writeURLTimeout = setTimeout( writeURL, 1500 );
- // Query all horizontal slides in the deck
- var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR );
-
// Find the current horizontal slide and any possible vertical slides
// within it
var currentHorizontalSlide = horizontalSlides[ indexh ],
@@ -1135,14 +1152,14 @@ var Reveal = (function(){
function navigateLeft() {
// Prioritize hiding fragments
if( availableRoutes().left && isOverviewActive() || previousFragment() === false ) {
- slide( indexh - 1, 0 );
+ slide( indexh - 1 );
}
}
function navigateRight() {
// Prioritize revealing fragments
if( availableRoutes().right && isOverviewActive() || nextFragment() === false ) {
- slide( indexh + 1, 0 );
+ slide( indexh + 1 );
}
}
@@ -1174,10 +1191,10 @@ var Reveal = (function(){
}
else {
// Fetch the previous horizontal slide, if there is one
- var previousSlide = document.querySelector( '.reveal .slides>section.past:nth-child(' + indexh + ')' );
+ var previousSlide = document.querySelector( HORIZONTAL_SLIDES_SELECTOR + '.past:nth-child(' + indexh + ')' );
if( previousSlide ) {
- indexv = ( previousSlide.querySelectorAll( 'section' ).length + 1 ) || 0;
+ indexv = ( previousSlide.querySelectorAll( 'section' ).length + 1 ) || undefined;
indexh --;
slide();
}