skip fragments when in overview
authorHakim El Hattab <hakim.elhattab@gmail.com>
Sat, 24 Dec 2011 05:22:13 +0000 (21:22 -0800)
committerHakim El Hattab <hakim.elhattab@gmail.com>
Sat, 24 Dec 2011 05:22:13 +0000 (21:22 -0800)
js/reveal.js

index ae3106f3dc95937444c7b897e964b940efbaf28b..58ae00a443aa5bd9ef6cfdca179f77ebe6879863 100644 (file)
@@ -61,6 +61,7 @@
  * 
  * version 1.1:
  * - Optional progress bar UI element
+ * - Slide overview available via SPACE
  * 
  * TODO:
  * - Touch/swipe interactions
@@ -286,10 +287,10 @@ var Reveal = (function(){
         * can't be improved.
         */
        function activateOverview() {
-               var horizontalSlides = Array.prototype.slice.call( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );
-
                document.body.classList.add( 'overview' );
 
+               var horizontalSlides = Array.prototype.slice.call( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );
+
                for( var i = 0, len = horizontalSlides.length; i < len; i++ ) {
                        var hslide = horizontalSlides[i],
                                htransform = 'translateZ(-2500px) translate(' + ( ( i - indexh ) * 105 ) + '%, 0%)';
@@ -567,7 +568,7 @@ var Reveal = (function(){
        
        function navigateLeft() {
                // Prioritize hiding fragments
-               if( previousFragment() === false ) {
+               if( overviewIsActive() || previousFragment() === false ) {
                        indexh --;
                        indexv = 0;
                        slide();
@@ -575,7 +576,7 @@ var Reveal = (function(){
        }
        function navigateRight() {
                // Prioritize revealing fragments
-               if( nextFragment() === false ) {
+               if( overviewIsActive() || nextFragment() === false ) {
                        indexh ++;
                        indexv = 0;
                        slide();
@@ -583,14 +584,14 @@ var Reveal = (function(){
        }
        function navigateUp() {
                // Prioritize hiding fragments
-               if( previousFragment() === false ) {
+               if( overviewIsActive() || previousFragment() === false ) {
                        indexv --;
                        slide();
                }
        }
        function navigateDown() {
                // Prioritize revealing fragments
-               if( nextFragment() === false ) {
+               if( overviewIsActive() || nextFragment() === false ) {
                        indexv ++;
                        slide();
                }