From 7f4e6cf5ece35de6b8511b842bd4f599f2312cd5 Mon Sep 17 00:00:00 2001 From: Alphons Joseph <93847055+Crazypersonalph@users.noreply.github.com> Date: Tue, 11 Feb 2025 19:42:41 +0800 Subject: [PATCH] create function to collapse sidebar --- src/SEQTA.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/SEQTA.ts b/src/SEQTA.ts index d211e106..21e7603e 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -400,6 +400,30 @@ export function OpenWhatsNewPopup() { }) } +export function hideSideBar() { + + + + const sidebar = document.getElementById('menu') // The sidebar element to be closed + const main = document.getElementById('main') // The main content element that must be resized to fill the page + + const currentMenuWidth = window.getComputedStyle(sidebar!).width // Get the styles of the different elements + const currentContentPosition = window.getComputedStyle(main!).position + + if (currentMenuWidth != "0") { // Actually modify it to collapse the sidebar + sidebar!.style.width = "0"; + } else { + sidebar!.style.width = "100%"; + } + + if (currentContentPosition != "relative") { + main!.style.position = 'relative'; + } else { + main!.style.position = 'absolute'; + } + +} + export function OpenAboutPage() { const background = document.createElement('div') background.id = 'whatsnewbk'