From a66d347606eeef18b441707fa45e7df646474691 Mon Sep 17 00:00:00 2001 From: Siddarth Gajjar Date: Tue, 12 Jan 2021 13:17:47 +0000 Subject: [PATCH] [FIX] website: fix background video placement in popup Before this commit, if you add a background video in a popup, the video frame will not setup properly because the _adjustIframe function cannot find wrapperWidth and its ratio. After this commit, _adjustIframe will be called again once the popup is opened. task-2251203 X-original-commit: 2b571bd012c8a1226d17edb2ee9dd2e6f74ce5d1 Part-of: odoo/odoo#79802 Co-authored-by: qsm-odoo --- .../static/src/js/content/snippets.animation.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/addons/website/static/src/js/content/snippets.animation.js b/addons/website/static/src/js/content/snippets.animation.js index 2a795a5cb23..c3ae343a756 100644 --- a/addons/website/static/src/js/content/snippets.animation.js +++ b/addons/website/static/src/js/content/snippets.animation.js @@ -697,6 +697,18 @@ registry.backgroundVideo = publicWidget.Widget.extend({ $(window).on('resize.' + this.iframeID, throttledUpdate); + const $modal = this.$target.closest('.modal'); + if ($modal.length) { + $modal.on('show.bs.modal', () => { + const videoContainerEl = this.$target[0].querySelector('.o_bg_video_container'); + videoContainerEl.classList.add('d-none'); + }); + $modal.on('shown.bs.modal', () => { + this._adjustIframe(); + const videoContainerEl = this.$target[0].querySelector('.o_bg_video_container'); + videoContainerEl.classList.remove('d-none'); + }); + } return Promise.all(proms).then(() => this._appendBgVideo()); }, /**