This commit is contained in:
Thomas Chartron 2021-11-12 20:27:41 +01:00
parent 2a07f865b1
commit dcd157bc8c
2 changed files with 9 additions and 4 deletions

View file

@ -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')

View file

@ -57,9 +57,11 @@
{% endif %}
{% endfor %}
<!-- More ... Button (sidebar) -->
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z"></path>
</svg>
<button id="toggle-sidebar">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z"></path>
</svg>
</button>
</div>
</div>