fragments now work in vertical slides (fixes #4)
authorHakim El Hattab <hakim.elhattab@gmail.com>
Sat, 17 Dec 2011 20:55:25 +0000 (12:55 -0800)
committerHakim El Hattab <hakim.elhattab@gmail.com>
Sat, 17 Dec 2011 20:55:25 +0000 (12:55 -0800)
css/main.css
js/reveal.js

index 40806d3ef40bc61f0a20e43e50590c03870830be..d2ab138c67f9ab77133de81803560e4c7a4277db 100644 (file)
@@ -364,7 +364,7 @@ a:not(.image) {
                border-radius: 2px;
        }
 
-img {
+section img {
        margin: 30px 0 0 0;
        background: rgba(255,255,255,0.12);
        border: 4px solid #eee;
index 6ce7a89ee120cb47af8d92e2ef3fb49ed4a1f97e..335e6198c148ab2a2640659da654786364f83a98 100644 (file)
@@ -358,13 +358,20 @@ var Reveal = (function(){
         * @return {Boolean} true if there was a next fragment,
         * false otherwise
         */
-       function nextFragment() {
-               var fragments = document.querySelectorAll( '.present .fragment:not(.visible)' );
-
-               if( fragments.length ) {
-                       fragments[0].classList.add( 'visible' );
-
-                       return true;
+       function nextFragment() {       
+               if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) {
+                       var verticalFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment:not(.visible)' );
+                       if( verticalFragments.length ) {
+                               verticalFragments[0].classList.add( 'visible' );
+                               return true;
+                       }
+               }
+               else {
+                       var horizontalFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment:not(.visible)' );
+                       if( horizontalFragments.length ) {
+                               horizontalFragments[0].classList.add( 'visible' );
+                               return true;
+                       }
                }
 
                return false;
@@ -377,14 +384,21 @@ var Reveal = (function(){
         * false otherwise
         */
        function previousFragment() {
-               var fragments = document.querySelectorAll( '.present .fragment.visible' );
-
-               if( fragments.length ) {
-                       fragments[ fragments.length - 1 ].classList.remove( 'visible' );
-
-                       return true;
+               if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) {
+                       var verticalFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment.visible' );
+                       if( verticalFragments.length ) {
+                               verticalFragments[ verticalFragments.length - 1 ].classList.remove( 'visible' );
+                               return true;
+                       }
                }
-
+               else {
+                       var horizontalFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment.visible' );
+                       if( horizontalFragments.length ) {
+                               horizontalFragments[ horizontalFragments.length - 1 ].classList.remove( 'visible' );
+                               return true;
+                       }
+               }
+               
                return false;
        }