Fixes sidebar collapsing

main
Yasen Pramatarov 2024-08-07 17:41:56 +03:00
parent 8a4816a6ae
commit 3943ba49b6
3 changed files with 22 additions and 30 deletions

View File

@ -78,31 +78,6 @@
color: white; color: white;
} }
/*
.results {
margin-bottom: 50px;
}
.results table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
.results table, th, td {
border: 1px solid #ddd;
}
.results th, td {
padding: 8px;
text-align: left;
}
.results th {
background-color: #f2f2f2;
}
.results p {
text-align: center;
}
*/
.results-header { .results-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -126,7 +101,7 @@
.toggle-sidebar-button { .toggle-sidebar-button {
position: absolute; position: absolute;
top: -10px; top: -10px;
left: 0; right: -10px;
z-index: 100; z-index: 100;
margin: 10px; margin: 10px;
height: 22px; height: 22px;
@ -143,6 +118,9 @@
.sidebar-wrapper.collapsed { .sidebar-wrapper.collapsed {
width: 3em; width: 3em;
} }
.sidebar-collapsed .sidebar-wrapper {
width: 3em;
}
.sidebar-content { .sidebar-content {
width: 250px; width: 250px;
border: none; border: none;
@ -153,11 +131,15 @@
} }
.main-content { .main-content {
transition: width: 0.5s ease; flex-grow: 1;
width: 80%; /* 75% */ transition: width 0.5s ease;
width: 80%;
} }
.main-content.expanded { .main-content.expanded {
width: 95%; /* none */ width: calc(70% + 250px);
}
.sidebar-collapsed .main-content {
width: calc(70% + 3em);
} }
.logo { .logo {

View File

@ -32,6 +32,7 @@ document.addEventListener('DOMContentLoaded', function () {
toggleButton.addEventListener('click', function () { toggleButton.addEventListener('click', function () {
// toggle sidebar and main content // toggle sidebar and main content
sidebar.classList.toggle('collapsed'); sidebar.classList.toggle('collapsed');
document.documentElement.classList.toggle('sidebar-collapsed');
mainContent.classList.toggle('expanded'); mainContent.classList.toggle('expanded');
// Toggle the value between ">>" and "<<" // Toggle the value between ">>" and "<<"
if (toggleButton.value === ">>") { if (toggleButton.value === ">>") {

View File

@ -7,7 +7,16 @@
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
<script>
// restore sidebar state before the page is rendered
(function () {
var savedState = localStorage.getItem('sidebarState');
if (savedState === 'collapsed') {
document.documentElement.classList.add('sidebar-collapsed');
}
})();
</script>
<title>Jilo Web</title> <title>Jilo Web</title>
</head> </head>