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:
Brad Gessler 2013-10-26 20:31:42 -07:00
parent f1f28f61e6
commit d66fe964bc

View file

@ -2017,6 +2017,11 @@ var Reveal = (function(){
} }
} ); } );
// iframe embeds
toArray( slide.querySelectorAll( 'iframe' ) ).forEach( function( el ) {
el.contentWindow.postMessage('slide:start', '*');
});
// YouTube embeds // YouTube embeds
toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) { toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) {
if( el.hasAttribute( 'data-autoplay' ) ) { 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 // YouTube embeds
toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) { toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) {
if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) { if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) {