about summary refs log tree commit diff
path: root/app/javascript/packs
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-01-19 18:28:37 +0100
committerThibaut Girka <thib@sitedethib.com>2019-01-19 18:28:37 +0100
commit5e0cf92fd145b27053389e5ffcce48da77439713 (patch)
tree27e1567b240f1a3117de595413ccceb9222d8465 /app/javascript/packs
parent530d29148ca0c5bf29f6fa516b1ef4f91d95894b (diff)
parent7c3fddeab4c4ddebca7d5441ac67870aa1cecfe4 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
No conflicts.
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);
+    }
   });
 }