Skip to content

Commit

Permalink
fragments now work in vertical slides (fixes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Dec 17, 2011
1 parent e6f444a commit 59c9b3c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
2 changes: 1 addition & 1 deletion css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
42 changes: 28 additions & 14 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit 59c9b3c

Please sign in to comment.