diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2018-10-09 11:08:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-09 11:08:09 +0200 |
commit | 62cd74a890ea3b150c77482d746a716d5001a323 (patch) | |
tree | c81bd73d236f6826d23b9b4f2fe38b9af7bd170e | |
parent | 7b707696b40a98e717d91e24162869f6d9c22957 (diff) | |
download | freenode-live-2017-presentation-62cd74a890ea3b150c77482d746a716d5001a323.tar freenode-live-2017-presentation-62cd74a890ea3b150c77482d746a716d5001a323.tar.gz |
add note about lazy loading iframes #1672 #1938
-rw-r--r-- | README.md | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -517,7 +517,7 @@ If there's some part of your content that needs to remain accessible to touch ev 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, audio and iframe elements. Lazy loaded iframes will also unload when the containing slide is no longer visible. +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> @@ -530,6 +530,12 @@ To enable lazy loading all you need to do is change your `src` attributes to `da </section> ``` +#### Lazy Loading Iframes +Note that lazy loaded iframes ignore the `viewDistance` configuration and will only load when their containing slide becomes visible. Iframes are also unloaded as soon as the slide is hidden. + +When we lazy load a video or audio element, reveal.js won't start playing that content until the slide becomes visible. However there is no way to control this for an iframe since that could contain any kind of content. That means if we loaded an iframe before the slide is visible on screen it could begin playing media and sound in the background. + + ### API The `Reveal` object exposes a JavaScript API for controlling navigation and reading state: |