about summary refs log tree commit diff
path: root/app/javascript/packs
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-01-20 13:56:37 +0100
committerGitHub <noreply@github.com>2019-01-20 13:56:37 +0100
commitaa362ab73dc7121104b3c01800152b9fc56ea396 (patch)
treef0f5879a51325856887a2e32a4c3f9654af61aab /app/javascript/packs
parent530d29148ca0c5bf29f6fa516b1ef4f91d95894b (diff)
parent5145c81620efbd5cf8dc911858d17d1fa888c996 (diff)
Merge pull request #888 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/packs')
-rw-r--r--app/javascript/packs/public.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js
index 69441d315..69e6ba0ec 100644
--- a/app/javascript/packs/public.js
+++ b/app/javascript/packs/public.js
@@ -91,6 +91,14 @@ function main() {
     if (parallaxComponents.length > 0 ) {
       new Rellax('.parallax', { speed: -1 });
     }
+
+    if (document.body.classList.contains('with-modals')) {
+      const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
+      const scrollbarWidthStyle = document.createElement('style');
+      scrollbarWidthStyle.id = 'scrollbar-width';
+      document.head.appendChild(scrollbarWidthStyle);
+      scrollbarWidthStyle.sheet.insertRule(`body.with-modals--active { margin-right: ${scrollbarWidth}px; }`, 0);
+    }
   });
 }