From d66fe964bc03c000da48dce0c2314936ef492fae Mon Sep 17 00:00:00 2001 From: Brad Gessler Date: Sat, 26 Oct 2013 20:31:42 -0700 Subject: [PATCH] Added support for postMessage's into any iframes for content that needs to do something when a slide is displayed and hidden. --- js/reveal.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/reveal.js b/js/reveal.js index a1ae5e4..7bc84de 100644 --- a/js/reveal.js +++ b/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' ) {