From 2bda228c7173425e1a2140fa2698e23f291ec8d7 Mon Sep 17 00:00:00 2001 From: Laurent Janet Date: Tue, 5 May 2020 19:37:18 +0200 Subject: [PATCH] fixes planning action container floating behavior --- assets/js/planning.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/assets/js/planning.js b/assets/js/planning.js index a37ac2eb..b28d06b6 100644 --- a/assets/js/planning.js +++ b/assets/js/planning.js @@ -74,8 +74,11 @@ $(document).ready(function () { $('#loader').hide(); const actionContainer = document.querySelector('.planning-actions-container-wrapper'); + const [planning] = $planning; - window.addEventListener('scroll', () => { - actionContainer.style.transform = `translate3d(${document.scrollingElement.scrollLeft}px, 0, 0)`; - }); + if (planning?.clientWidth > window.innerWidth) { + window.addEventListener('scroll', () => { + actionContainer.style.transform = `translate3d(${document.scrollingElement.scrollLeft}px, 0, 0)`; + }); + } });