parent
7b707696b4
commit
62cd74a890
@ -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.
|
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
|
```html
|
||||||
<section>
|
<section>
|
||||||
@ -530,6 +530,12 @@ To enable lazy loading all you need to do is change your `src` attributes to `da
|
|||||||
</section>
|
</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
|
### API
|
||||||
|
|
||||||
The `Reveal` object exposes a JavaScript API for controlling navigation and reading state:
|
The `Reveal` object exposes a JavaScript API for controlling navigation and reading state:
|
||||||
|
Loading…
Reference in New Issue
Block a user