From da50605b4e9eed88be771a38d5b6a0362fca8cd8 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Sat, 26 Sep 2020 23:55:02 +0300 Subject: [PATCH] Hide scrollbar only for fullscreen --- src/plugins/youtubePlayer/plugin.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/youtubePlayer/plugin.js b/src/plugins/youtubePlayer/plugin.js index 57e49e1d1a..5b921010a2 100644 --- a/src/plugins/youtubePlayer/plugin.js +++ b/src/plugins/youtubePlayer/plugin.js @@ -15,6 +15,10 @@ 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'); @@ -37,8 +41,9 @@ function createMediaElement(instance, options) { document.body.insertBefore(dlg, document.body.firstChild); instance.videoDialog = dlg; - // 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'); + if (options.fullscreen) { + hideScroll(); + } if (options.fullscreen && dlg.animate && !browser.slow) { zoomIn(dlg, 1).onfinish = function () { @@ -49,6 +54,10 @@ function createMediaElement(instance, options) { } }); } else { + if (options.fullscreen) { + hideScroll(); + } + resolve(dlg.querySelector('#player')); } });