diff --git a/js/reveal.js b/js/reveal.js
index ae35bf0e34a6b72964f31bc091ecff423abde005..2355098f943b70238b4b088533b94b605dd84de5 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -2146,7 +2146,7 @@
 			distanceX,
 			distanceY;
 
-		if( horizontalSlidesLength ) {
+		if( horizontalSlidesLength && typeof indexh !== 'undefined' ) {
 
 			// The number of steps away from the present slide that will
 			// be visible