aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-04-22 16:10:08 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-04-22 16:10:08 +0200
commit73f96f1d284bca6e01c36c888c2620b376c06598 (patch)
tree3a9170f600f00505d69b61407c228bdfc8dc7dd2 /js
parent3ad0d6adc026c620af1b2eaadabd2ce2c338e2f1 (diff)
downloadperl-software-in-gnu-guix-73f96f1d284bca6e01c36c888c2620b376c06598.tar
perl-software-in-gnu-guix-73f96f1d284bca6e01c36c888c2620b376c06598.tar.gz
lazy-load support for audio #793
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/js/reveal.js b/js/reveal.js
index e910682..42edf90 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -2173,25 +2173,25 @@ var Reveal = (function(){
function loadSlide( slide ) {
// Media elements with data-src attributes
- toArray( slide.querySelectorAll( 'img[data-src], video[data-src]' ) ).forEach( function( element ) {
+ toArray( slide.querySelectorAll( 'img[data-src], video[data-src], audio[data-src]' ) ).forEach( function( element ) {
element.setAttribute( 'src', element.getAttribute( 'data-src' ) );
element.removeAttribute( 'data-src' );
} );
- // Video elements with multiple <source>s
- toArray( slide.querySelectorAll( 'video' ) ).forEach( function( video ) {
+ // Media elements with multiple <source>s
+ toArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( media ) {
var sources = 0;
- toArray( slide.querySelectorAll( 'source[data-src]' ) ).forEach( function( source ) {
+ toArray( media.querySelectorAll( 'source[data-src]' ) ).forEach( function( source ) {
source.setAttribute( 'src', source.getAttribute( 'data-src' ) );
source.removeAttribute( 'data-src' );
sources += 1;
} );
- // If we rewrote sources for this video, we need to manually
- // tell it to load from its new origin
+ // If we rewrote sources for this video/audio element, we need
+ // to manually tell it to load from its new origin
if( sources > 0 ) {
- video.load();
+ media.load();
}
} );