about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/packs/public.js
diff options
context:
space:
mode:
authorpluralcafe-docker <git@plural.cafe>2019-01-21 04:35:41 +0000
committerpluralcafe-docker <git@plural.cafe>2019-01-21 04:35:41 +0000
commit657438e95054ba1f161db698acdf7f1a871d1c9c (patch)
treea3344b6105b7771983f69c789fb2f7a0c22a8583 /app/javascript/flavours/glitch/packs/public.js
parentd899138556513c8a5fa3397606ecc4752b7c6785 (diff)
parentb7c67605d5c2110b4a3cd3d8a7b8ef2878cbfe48 (diff)
Merge branch 'master' into production
Diffstat (limited to 'app/javascript/flavours/glitch/packs/public.js')
-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);
+    }
   });
 }