瀏覽代碼

fix bug where left/right arrows appeared when there were no horizontal slides

Hakim El Hattab 6 年之前
父節點
當前提交
e704b3ffc8
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      js/reveal.js

+ 4 - 2
js/reveal.js

@@ -3364,9 +3364,11 @@
 		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,
-			right: indexh < horizontalSlides.length - 1 || config.loop,
+			left: indexh > 0 || ( config.loop && hasHorizontalSlides ),
+			right: indexh < horizontalSlides.length - 1 || ( config.loop && hasHorizontalSlides ),
 			up: indexv > 0,
 			down: indexv < verticalSlides.length - 1
 		};