diff options
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | js/reveal.js | 2 |
2 files changed, 4 insertions, 3 deletions
@@ -295,13 +295,14 @@ Reveal.configure({ ### Lazy Loading -When working on presentation with a lot of image, video and audio content it's important to load lazily. Lazy loading means that reveal.js will only load the media for the few slides nearest to the current slide. The number of slides that are preloaded is determined by the `viewDistance` configuration option. +When working on presentation with a lot of media or iframe content it's important to load lazily. Lazy loading means that reveal.js will only load content for the few slides nearest to the current slide. The number of slides that are preloaded is determined by the `viewDistance` configuration option. -To enable lazy loading all you need to do is change your "src" attributes to "data-src" as shown below. This is supported for image, video and audio elements. +To enable lazy loading all you need to do is change your "src" attributes to "data-src" as shown below. This is supported for image, video, audio and iframe elements. ```html <section> <img data-src="image.png"> + <iframe data-src="http://slides.com"> <video> <source data-src="video.webm" type="video/webm" /> <source data-src="video.mp4" type="video/mp4" /> diff --git a/js/reveal.js b/js/reveal.js index 1238f9f..7a032d0 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2178,7 +2178,7 @@ var Reveal = (function(){ function loadSlide( slide ) { // Media elements with data-src attributes - toArray( slide.querySelectorAll( 'img[data-src], video[data-src], audio[data-src]' ) ).forEach( function( element ) { + toArray( slide.querySelectorAll( 'img[data-src], video[data-src], audio[data-src], iframe[data-src]' ) ).forEach( function( element ) { element.setAttribute( 'src', element.getAttribute( 'data-src' ) ); element.removeAttribute( 'data-src' ); } ); |