Added support for postMessage's into any iframes for content that needs to do something when a slide is displayed and hidden.
This commit is contained in:
parent
f1f28f61e6
commit
d66fe964bc
1 changed files with 10 additions and 0 deletions
10
js/reveal.js
10
js/reveal.js
|
@ -2017,6 +2017,11 @@ var Reveal = (function(){
|
|||
}
|
||||
} );
|
||||
|
||||
// iframe embeds
|
||||
toArray( slide.querySelectorAll( 'iframe' ) ).forEach( function( el ) {
|
||||
el.contentWindow.postMessage('slide:start', '*');
|
||||
});
|
||||
|
||||
// YouTube embeds
|
||||
toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) {
|
||||
if( el.hasAttribute( 'data-autoplay' ) ) {
|
||||
|
@ -2041,6 +2046,11 @@ var Reveal = (function(){
|
|||
}
|
||||
} );
|
||||
|
||||
// iframe embeds
|
||||
toArray( slide.querySelectorAll( 'iframe' ) ).forEach( function( el ) {
|
||||
el.contentWindow.postMessage('slide:stop', '*');
|
||||
});
|
||||
|
||||
// YouTube embeds
|
||||
toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) {
|
||||
if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) {
|
||||
|
|
Loading…
Reference in a new issue