fix previous slide navigation logic (closes #397)
[reveal.js.git] / js / reveal.js
index f7f752f51332cfc16703621ba06ec3e0df4e7926..516d114e83d2c950da5e42c3a0a4f281aeb2593c 100644 (file)
@@ -73,6 +73,9 @@ var Reveal = (function(){
                        // Transition style
                        transition: 'default', // default/cube/page/concave/zoom/linear/fade/none
 
+                       // Transition speed
+                       transitionSpeed: 'default', // default/fast/slow
+
                        // Script dependencies to load
                        dependencies: []
                },
@@ -340,6 +343,8 @@ var Reveal = (function(){
 
                dom.wrapper.classList.add( config.transition );
 
+               dom.wrapper.setAttribute( 'data-transition-speed', config.transitionSpeed );
+
                if( dom.controls ) {
                        dom.controls.style.display = ( config.controls && dom.controls ) ? 'block' : 'none';
                }
@@ -645,13 +650,6 @@ var Reveal = (function(){
 
        }
 
-       /**
-        * Returns last element of an array
-        */
-       function lastElem(array) {
-               return array.slice(-1)[0];
-       }
-
        /**
         * Applies JavaScript-controlled layout rules to the
         * presentation.
@@ -1629,7 +1627,7 @@ var Reveal = (function(){
                                if( previousSlide ) {
                                        indexv = ( previousSlide.querySelectorAll( 'section' ).length + 1 ) || undefined;
                                        indexh --;
-                                       slide();
+                                       slide( indexh, indexv );
                                }
                        }
                }
@@ -2054,21 +2052,12 @@ var Reveal = (function(){
 
                // Returns an index (1-based) of the current fragment
                getCurrentFragmentIndex : function() {
-                       var visibleFragments;
-                       
-                       // vertical slides:
-                       if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) {
-                               visibleFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment.visible' );
-                       }
-                       // Horizontal slides:
-                       else {
-                               visibleFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment.visible' );
-                       }
-                       
-                       if( visibleFragments.length) {
-                               return visibleFragments.length;
-                       } else {
-                               return undefined;
+                       if( currentSlide ) {
+                               var visibleFragments = currentSlide.querySelectorAll( '.fragment.visible' );
+
+                               if( visibleFragments.length ) {
+                                       return visibleFragments.length;
+                               }
                        }
                },