aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2011-12-17 12:55:25 -0800
committerHakim El Hattab <hakim.elhattab@gmail.com>2011-12-17 12:55:25 -0800
commit59c9b3c5968a167acb2814aeff32eb208df23e66 (patch)
treeedd0a452c69184d61cd405f484fbdd4345212bd0 /js
parente6f444a30702b5c09325a2d46cccb727aab0e4e7 (diff)
downloadperl-software-in-gnu-guix-59c9b3c5968a167acb2814aeff32eb208df23e66.tar
perl-software-in-gnu-guix-59c9b3c5968a167acb2814aeff32eb208df23e66.tar.gz
fragments now work in vertical slides (fixes #4)
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js42
1 files changed, 28 insertions, 14 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 6ce7a89..335e619 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -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;
}