From 98644513addf9bf96cf229aaeaf6054271ba0dfc Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Wed, 30 Oct 2019 22:11:09 +0100 Subject: [PATCH] When movie popup opens we add a no-scroll class to the body element. This prevents scrolling the content behind the popover content. --- src/App.vue | 4 ++++ src/components/MoviePopup.vue | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/App.vue b/src/App.vue index b1eb59e..c8b8753 100644 --- a/src/App.vue +++ b/src/App.vue @@ -123,6 +123,10 @@ img{ height: auto; } +.no-scroll { + overflow: hidden; +} + .wrapper{ position: relative; } diff --git a/src/components/MoviePopup.vue b/src/components/MoviePopup.vue index b71a5e2..9e30535 100644 --- a/src/components/MoviePopup.vue +++ b/src/components/MoviePopup.vue @@ -32,9 +32,11 @@ export default { }, created(){ window.addEventListener('keyup', this.checkEventForEscapeKey) + document.getElementsByTagName("body")[0].classList += " no-scroll"; }, beforeDestroy() { window.removeEventListener('keyup', this.checkEventForEscapeKey) + document.getElementsByTagName("body")[0].classList.remove("no-scroll"); } }