From dcd157bc8c0a2d8f187d39f92e309f56be2f60b9 Mon Sep 17 00:00:00 2001 From: Thomas Chartron Date: Fri, 12 Nov 2021 20:27:41 +0100 Subject: [PATCH] update --- src/js/main.js | 5 ++++- templates/layout.html | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/js/main.js b/src/js/main.js index 337483a..bfaca6f 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -20,6 +20,9 @@ document.addEventListener("DOMContentLoaded", function() { } // Switch theme action document.getElementById('switch-theme').addEventListener('click', switchTheme); + + // ---------------- Toggle Sidebar ------------------------- + document.getElementById('toggle-sidebar').addEventListener('click', toggleSidebar); }); function switchTheme() { @@ -39,7 +42,7 @@ function switchTheme() { function toggleSidebar() { let sidebar = document.getElementById('sidebar'); - if (sidebar.classList.includes('translate-x-0')) { + if ([...sidebar.classList].includes('translate-x-0')) { console.log('visible') } else { console.log('not visible') diff --git a/templates/layout.html b/templates/layout.html index 2246eeb..14029d4 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -57,9 +57,11 @@ {% endif %} {% endfor %} - - - +