fix navigatePrev in rtl mode #1030

This commit is contained in:
Hakim El Hattab 2014-10-16 16:17:41 +02:00
parent 6c7ba34edf
commit 82342672ea

View file

@ -3426,10 +3426,20 @@
navigateUp(); navigateUp();
} }
else { else {
// Fetch the previous horizontal slide, if there is one
var previousSlide;
if( config.rtl ) { if( config.rtl ) {
navigateRight(); previousSlide = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.future' ) ).pop();
} else { }
navigateLeft(); else {
previousSlide = toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.past' ) ).pop();
}
if( previousSlide ) {
var v = ( previousSlide.querySelectorAll( 'section' ).length - 1 ) || undefined;
var h = indexh - 1;
slide( h, v );
} }
} }
} }
@ -3437,16 +3447,20 @@
} }
/** /**
* Same as #navigatePrev() but navigates forwards. * The reverse of #navigatePrev().
*/ */
function navigateNext() { function navigateNext() {
// Prioritize revealing fragments // Prioritize revealing fragments
if( nextFragment() === false ) { if( nextFragment() === false ) {
if( config.rtl ) { if( availableRoutes().down ) {
availableRoutes().down ? navigateDown() : navigateLeft(); navigateDown();
} else { }
availableRoutes().down ? navigateDown() : navigateRight(); else if( config.rtl ) {
navigateLeft();
}
else {
navigateRight();
} }
} }