diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index 8ebbacb129..45c4e6c6fd 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -105,11 +105,6 @@ function tryRemoveElement(elem) { }); } - function hideScroll() { - // At this point, we must hide the scrollbar placeholder, so it's not being displayed while the item is being loaded - document.body.classList.add('hide-scroll'); - } - function zoomIn(elem) { return new Promise(resolve => { const duration = 240; @@ -1347,7 +1342,8 @@ function tryRemoveElement(elem) { this.#mediaElement = videoElement; if (options.fullscreen) { - hideScroll(); + // At this point, we must hide the scrollbar placeholder, so it's not being displayed while the item is being loaded + document.body.classList.add('hide-scroll'); } // don't animate on smart tv's, too slow @@ -1362,7 +1358,7 @@ function tryRemoveElement(elem) { } else { // we need to hide scrollbar when starting playback from page with animated background if (options.fullscreen) { - hideScroll(); + document.body.classList.add('hide-scroll'); } return Promise.resolve(dlg.querySelector('video')); diff --git a/src/plugins/youtubePlayer/plugin.js b/src/plugins/youtubePlayer/plugin.js index de2081c089..f7bc7a1428 100644 --- a/src/plugins/youtubePlayer/plugin.js +++ b/src/plugins/youtubePlayer/plugin.js @@ -15,10 +15,6 @@ function zoomIn(elem, iterations) { return elem.animate(keyframes, timing); } -function hideScroll() { - document.body.classList.add('hide-scroll'); -} - function createMediaElement(instance, options) { return new Promise(function (resolve, reject) { const dlg = document.querySelector('.youtubePlayerContainer'); @@ -42,7 +38,7 @@ function createMediaElement(instance, options) { instance.videoDialog = dlg; if (options.fullscreen) { - hideScroll(); + document.body.classList.add('hide-scroll'); } if (options.fullscreen && dlg.animate && !browser.slow) { @@ -56,7 +52,7 @@ function createMediaElement(instance, options) { } else { // we need to hide scrollbar when starting playback from page with animated background if (options.fullscreen) { - hideScroll(); + document.body.classList.add('hide-scroll'); } resolve(dlg.querySelector('#player'));