diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2018-10-26 11:29:08 +0200 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2018-10-26 11:29:08 +0200 |
commit | 42e796afb2a4db10772cf0f4b517094c0fbec644 (patch) | |
tree | 2bc54d5c714bde14abe6b6a34292a29f3f214ac0 /js | |
parent | 6abc6e00581e66690416978de118145e854c3c1e (diff) | |
download | perl-software-in-gnu-guix-42e796afb2a4db10772cf0f4b517094c0fbec644.tar perl-software-in-gnu-guix-42e796afb2a4db10772cf0f4b517094c0fbec644.tar.gz |
dispatch state events after current slide has updated #2264
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/js/reveal.js b/js/reveal.js index f797084..1c0e69d 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2671,28 +2671,6 @@ layout(); - // Apply the new state - stateLoop: for( var i = 0, len = state.length; i < len; i++ ) { - // Check if this state existed on the previous slide. If it - // did, we will avoid adding it repeatedly - for( var j = 0; j < stateBefore.length; j++ ) { - if( stateBefore[j] === state[i] ) { - stateBefore.splice( j, 1 ); - continue stateLoop; - } - } - - document.documentElement.classList.add( state[i] ); - - // Dispatch custom event matching the state's name - dispatchEvent( state[i] ); - } - - // Clean up the remains of the previous state - while( stateBefore.length ) { - document.documentElement.classList.remove( stateBefore.pop() ); - } - // Update the overview if it's currently active if( isOverview() ) { updateOverview(); @@ -2741,6 +2719,28 @@ } } + // Apply the new state + stateLoop: for( var i = 0, len = state.length; i < len; i++ ) { + // Check if this state existed on the previous slide. If it + // did, we will avoid adding it repeatedly + for( var j = 0; j < stateBefore.length; j++ ) { + if( stateBefore[j] === state[i] ) { + stateBefore.splice( j, 1 ); + continue stateLoop; + } + } + + document.documentElement.classList.add( state[i] ); + + // Dispatch custom event matching the state's name + dispatchEvent( state[i] ); + } + + // Clean up the remains of the previous state + while( stateBefore.length ) { + document.documentElement.classList.remove( stateBefore.pop() ); + } + if( slideChanged ) { dispatchEvent( 'slidechanged', { 'indexh': indexh, |