diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2013-05-05 18:44:10 -0400 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2013-05-05 18:44:10 -0400 |
commit | db4eb20bc3f9464953292b102ecd967e82a88891 (patch) | |
tree | a1e1a64480260c65c8c5b6a9e2bec33cbbf63d86 /js | |
parent | 6b6c87db976d70d8080327197e5f00ace64c75bf (diff) | |
parent | 76fce3b4d9f524e9a6534bb19745894e1c743849 (diff) | |
download | fosdem-2018-presentation-db4eb20bc3f9464953292b102ecd967e82a88891.tar fosdem-2018-presentation-db4eb20bc3f9464953292b102ecd967e82a88891.tar.gz |
merge notes float fix and support for multiple fragments with same index
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/js/reveal.js b/js/reveal.js index c985f79..2b77e87 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1632,11 +1632,19 @@ var Reveal = (function(){ var fragments = sortFragments( currentSlide.querySelectorAll( '.fragment:not(.visible)' ) ); if( fragments.length ) { - fragments[0].classList.add( 'visible' ); - - // Notify subscribers of the change - dispatchEvent( 'fragmentshown', { fragment: fragments[0] } ); - + // There may be multiple fragments with the same index. We want to display all of them. + var nextFragmentIndex = fragments[0].getAttribute( 'data-fragment-index' ); + + toArray( fragments ).forEach( function( thisFragment ) { + var f = thisFragment.getAttribute( 'data-fragment-index' ); + if( f === nextFragmentIndex ) { + thisFragment.classList.add( 'visible' ); + + // Notify subscribers of the change + dispatchEvent( 'fragmentshown', { fragment: thisFragment } ); + } + } ); + updateControls(); return true; } @@ -1658,10 +1666,18 @@ var Reveal = (function(){ var fragments = sortFragments( currentSlide.querySelectorAll( '.fragment.visible' ) ); if( fragments.length ) { - fragments[ fragments.length - 1 ].classList.remove( 'visible' ); - - // Notify subscribers of the change - dispatchEvent( 'fragmenthidden', { fragment: fragments[ fragments.length - 1 ] } ); + // There may be multiple fragments with the same index. We want to display all of them. + var prevFragmentIndex = fragments[0].getAttribute( 'data-fragment-index' ); + + toArray( fragments ).forEach( function( thisFragment ) { + var f = thisFragment.getAttribute( 'data-fragment-index' ); + if( f === prevFragmentIndex ) { + thisFragment.classList.remove( 'visible' ); + + // Notify subscribers of the change + dispatchEvent( 'fragmenthidden', { fragment: thisFragment } ); + } + } ); updateControls(); return true; @@ -2229,4 +2245,4 @@ var Reveal = (function(){ } }; -})();
\ No newline at end of file +})(); |