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:
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>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% 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 %}
|
{% for path in config.extra_javascript %}
|
||||||
<script src="{{ path | url }}"></script>
|
<script src="{{ path | url }}"></script>
|
||||||
{% endfor %}
|
{% 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 */
|
/* Create and return component */
|
||||||
return watchContentTabs(el)
|
return watchContentTabs(el)
|
||||||
.pipe(
|
.pipe(
|
||||||
|
|||||||
Reference in New Issue
Block a user