diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-01-30 10:52:28 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-01-30 10:52:28 +0100 |
commit | 49f462e6ce329b9c569d4735ab617ac07385b17b (patch) | |
tree | 016e836cfbf4789b0a6a528499b1a4f1ffcabecc /js/reveal.js | |
parent | 621e8d71764cf19f329da3757caaa6f62fe2dbf2 (diff) | |
download | freenode-live-2017-presentation-49f462e6ce329b9c569d4735ab617ac07385b17b.tar freenode-live-2017-presentation-49f462e6ce329b9c569d4735ab617ac07385b17b.tar.gz |
gifs now restart when their slide container is shown
Diffstat (limited to 'js/reveal.js')
-rw-r--r-- | js/reveal.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/js/reveal.js b/js/reveal.js index ad2d5a3..afbfb6e 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2580,6 +2580,15 @@ currentVideo.play(); } + var backgroundImageURL = currentBackground.style.backgroundImage || ''; + + // Restart GIFs (doesn't work in Firefox) + if( /\.gif/i.test( backgroundImageURL ) ) { + currentBackground.style.backgroundImage = ''; + window.getComputedStyle( currentBackground ).opacity; + currentBackground.style.backgroundImage = backgroundImageURL; + } + // Don't transition between identical backgrounds. This // prevents unwanted flicker. var previousBackgroundHash = previousBackground ? previousBackground.getAttribute( 'data-background-hash' ) : null; @@ -2826,6 +2835,13 @@ function startEmbeddedContent( slide ) { if( slide && !isSpeakerNotes() ) { + // Restart GIFs + toArray( slide.querySelectorAll( 'img[src$=".gif"]' ) ).forEach( function( el ) { + // Setting the same unchanged source like this was confirmed + // to work in Chrome, FF & Safari + el.setAttribute( 'src', el.getAttribute( 'src' ) ); + } ); + // HTML5 media elements toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) { if( el.hasAttribute( 'data-autoplay' ) ) { |