mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Automatically pause media when content tabs are hidden
This commit is contained in:
parent
3520926284
commit
01136b2fb9
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -240,7 +240,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.fac441b0.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.c2be25ad.min.js' | url }}"></script>
|
||||
{% for path in config.extra_javascript %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -244,6 +244,13 @@ export function mountContentTabs(
|
||||
}
|
||||
})
|
||||
|
||||
/* Pause media (audio, video) on switch - see https://bit.ly/3Bk6cel */
|
||||
push$.pipe(takeUntil(done$))
|
||||
.subscribe(() => {
|
||||
for (const media of getElements<HTMLAudioElement>("audio, video", el))
|
||||
media.pause()
|
||||
})
|
||||
|
||||
/* Create and return component */
|
||||
return watchContentTabs(el)
|
||||
.pipe(
|
||||
|
Loading…
Reference in New Issue
Block a user