fix looping of presentations that only have vertical slides

This commit is contained in:
Hakim El Hattab 2018-02-07 13:45:52 +01:00
parent 5eba331935
commit 27aba10756

View File

@ -3368,16 +3368,28 @@
var horizontalSlides = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ), var horizontalSlides = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ),
verticalSlides = dom.wrapper.querySelectorAll( VERTICAL_SLIDES_SELECTOR ); verticalSlides = dom.wrapper.querySelectorAll( VERTICAL_SLIDES_SELECTOR );
var hasHorizontalSlides = horizontalSlides.length > 1;
var routes = { var routes = {
left: indexh > 0 || ( config.loop && hasHorizontalSlides ), left: indexh > 0,
right: indexh < horizontalSlides.length - 1 || ( config.loop && hasHorizontalSlides ), right: indexh < horizontalSlides.length - 1,
up: indexv > 0, up: indexv > 0,
down: indexv < verticalSlides.length - 1 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 ) { if( config.rtl ) {
var left = routes.left; var left = routes.left;
routes.left = routes.right; routes.left = routes.right;