about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/packs
diff options
context:
space:
mode:
authorpluralcafe-docker <git@plural.cafe>2019-01-21 04:35:29 +0000
committerpluralcafe-docker <git@plural.cafe>2019-01-21 04:35:29 +0000
commitb7c67605d5c2110b4a3cd3d8a7b8ef2878cbfe48 (patch)
treea3344b6105b7771983f69c789fb2f7a0c22a8583 /app/javascript/flavours/glitch/packs
parentfb7ec403227690f897a9a693f2461b94bf7e2582 (diff)
parentaa362ab73dc7121104b3c01800152b9fc56ea396 (diff)
Merge branch 'glitch'
Diffstat (limited to 'app/javascript/flavours/glitch/packs')
-rw-r--r--app/javascript/flavours/glitch/packs/public.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/packs/public.js b/app/javascript/flavours/glitch/packs/public.js
index 56012ba78..da0b4c8e0 100644
--- a/app/javascript/flavours/glitch/packs/public.js
+++ b/app/javascript/flavours/glitch/packs/public.js
@@ -86,6 +86,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);
+    }
   });
 }