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
1 changed files with 10 additions and 0 deletions

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
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' ) {