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
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
|
// 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' ) {
|
||||||
|
|
Loading…
Reference in New Issue