@gouvfr/dsfr-roller
Version:
Le module `dsfr-roller` permet de publier le site de documentation du Système de Design de l’État - DSFR
21 lines (16 loc) • 498 B
JavaScript
import { Element } from '../main/core/element.js'
class StopVideoOnClose extends Element {
init() {
this._element.addEventListener('dsfr.conceal', () => {
this._iframe = this._element.querySelector('iframe');
if (this._iframe) {
this._iframe.setAttribute('src', this._iframe.getAttribute('src'));
}
this._video = this._element.querySelector('video');
if (this._video) {
this._video.pause();
}
});
}
}
export { StopVideoOnClose };