From 27aba10756fdde8b041e80cf55742dfeef4b6228 Mon Sep 17 00:00:00 2001
From: Hakim El Hattab <hakim.elhattab@gmail.com>
Date: Wed, 7 Feb 2018 13:45:52 +0100
Subject: [PATCH] fix looping of presentations that only have vertical slides

---
 js/reveal.js | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/js/reveal.js b/js/reveal.js
index 0d499577..e3ffeac8 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -3368,16 +3368,28 @@
 		var horizontalSlides = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ),
 			verticalSlides = dom.wrapper.querySelectorAll( VERTICAL_SLIDES_SELECTOR );
 
-		var hasHorizontalSlides = horizontalSlides.length > 1;
-
 		var routes = {
-			left: indexh > 0 || ( config.loop && hasHorizontalSlides ),
-			right: indexh < horizontalSlides.length - 1 || ( config.loop && hasHorizontalSlides ),
+			left: indexh > 0,
+			right: indexh < horizontalSlides.length - 1,
 			up: indexv > 0,
 			down: indexv < verticalSlides.length - 1
 		};
 
-		// reverse horizontal controls for rtl
+		// Looped presentations can always be navigated as long as
+		// there are slides available
+		if( config.loop ) {
+			if( horizontalSlides.length > 1 ) {
+				routes.left = true;
+				routes.right = true;
+			}
+
+			if( verticalSlides.length > 1 ) {
+				routes.up = true;
+				routes.down = true;
+			}
+		}
+
+		// Reverse horizontal controls for rtl
 		if( config.rtl ) {
 			var left = routes.left;
 			routes.left = routes.right;
-- 
GitLab