From 534004acf6ea6bf4b39ea6b17741b5443c1eb910 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Tue, 7 Mar 2023 18:10:24 -0500 Subject: [PATCH] Making charts more mobile friendly on "Today's Detections" --- scripts/todays_detections.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index 4251a50..2c8355e 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -656,7 +656,11 @@ function generateMiniGraph(elem, comname) { // Position the chart window to the right of the button var buttonRect = elem.getBoundingClientRect(); var chartRect = chartWindow.getBoundingClientRect(); - chartWindow.style.left = (buttonRect.right + 10) + 'px'; + if (window.innerWidth < 700) { + chartWindow.style.left = 'calc(75% - ' + (chartRect.width / 2) + 'px)'; + } else { + chartWindow.style.left = (buttonRect.right + 10) + 'px'; + } // Calculate the top position of the chart to center it with the button var buttonCenter = buttonRect.top + (buttonRect.height / 2);