diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2018-02-12 13:49:33 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2018-02-12 13:49:33 +0100 |
commit | 325162692ea2de30e4f7ebd8b858da15580844f1 (patch) | |
tree | 67d83fe73fa2399c8daa763604066ee921b71341 | |
parent | d5f4edeeefa943f0422b8816e3099aa4f534d3b1 (diff) | |
download | freenode-live-2017-presentation-325162692ea2de30e4f7ebd8b858da15580844f1.tar freenode-live-2017-presentation-325162692ea2de30e4f7ebd8b858da15580844f1.tar.gz |
navigateNext no longer gets stuck on first stack when looping is enabled
-rw-r--r-- | js/reveal.js | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/js/reveal.js b/js/reveal.js index 95d1b8c..230d001 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -4410,7 +4410,17 @@ // Prioritize revealing fragments if( nextFragment() === false ) { - if( availableRoutes().down ) { + + var routes = availableRoutes(); + + // When looping is enabled `routes.down` is always available + // so we need a separate check for when we've reached the + // end of a stack and should move horizontally + if( routes.down && routes.right && config.loop && Reveal.isLastVerticalSlide( currentSlide ) ) { + routes.down = false; + } + + if( routes.down ) { navigateDown(); } else if( config.rtl ) { @@ -5300,7 +5310,7 @@ // Returns true if we're currently on the last slide isLastSlide: function() { if( currentSlide ) { - // Does this slide has next a sibling? + // Does this slide have a next sibling? if( currentSlide.nextElementSibling ) return false; // If it's vertical, does its parent have a next sibling? @@ -5312,6 +5322,19 @@ return false; }, + // Returns true if we're on the last slide in the current + // vertical stack + isLastVerticalSlide: function() { + if( currentSlide && isVerticalSlide( currentSlide ) ) { + // Does this slide have a next sibling? + if( currentSlide.nextElementSibling ) return false; + + return true; + } + + return false; + }, + // Checks if reveal.js has been loaded and is ready for use isReady: function() { return loaded; |