mirror of
https://github.com/Noratrieb/slides.git
synced 2026-01-16 17:35:06 +01:00
dispatch events when visible fragment changes ('fragmentshown', 'fragmenthidden') closes #44
This commit is contained in:
parent
31bbfe9398
commit
aaf9da450f
3 changed files with 32 additions and 5 deletions
12
js/reveal.js
12
js/reveal.js
|
|
@ -654,6 +654,9 @@ var Reveal = (function(){
|
|||
var verticalFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment:not(.visible)' );
|
||||
if( verticalFragments.length ) {
|
||||
verticalFragments[0].classList.add( 'visible' );
|
||||
|
||||
// Notify subscribers of the change
|
||||
dispatchEvent( 'fragmentshown', { fragment: verticalFragments[0] } );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -662,6 +665,9 @@ var Reveal = (function(){
|
|||
var horizontalFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment:not(.visible)' );
|
||||
if( horizontalFragments.length ) {
|
||||
horizontalFragments[0].classList.add( 'visible' );
|
||||
|
||||
// Notify subscribers of the change
|
||||
dispatchEvent( 'fragmentshown', { fragment: horizontalFragments[0] } );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -681,6 +687,9 @@ var Reveal = (function(){
|
|||
var verticalFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment.visible' );
|
||||
if( verticalFragments.length ) {
|
||||
verticalFragments[ verticalFragments.length - 1 ].classList.remove( 'visible' );
|
||||
|
||||
// Notify subscribers of the change
|
||||
dispatchEvent( 'fragmenthidden', { fragment: verticalFragments[0] } );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -689,6 +698,9 @@ var Reveal = (function(){
|
|||
var horizontalFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment.visible' );
|
||||
if( horizontalFragments.length ) {
|
||||
horizontalFragments[ horizontalFragments.length - 1 ].classList.remove( 'visible' );
|
||||
|
||||
// Notify subscribers of the change
|
||||
dispatchEvent( 'fragmenthidden', { fragment: horizontalFragments[0] } );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue