Fixes sidebar sliding

main
Yasen Pramatarov 2024-08-05 17:02:35 +03:00
parent ca95f3c27e
commit b6fc4a995d
4 changed files with 10 additions and 8 deletions

View File

@ -121,15 +121,16 @@
border: 1px solid gray; border: 1px solid gray;
} }
/* collapsing sidebar */
.sidebar-wrapper { .sidebar-wrapper {
width: 250px; /* Default width of the sidebar */ width: 250px;
transition: width 0.3s; /* Smooth transition for collapsing */ transition: width 0.5s ease;
overflow-x: hidden; /* Hide horizontal scrollbar */ overflow-x: hidden;
} }
.sidebar-wrapper.collapsed { .sidebar-wrapper.collapsed {
width: 0; /* Collapsed width */ width: 2em;
} }
.sidebar-content { .sidebar-content {
width: 250px; /* Keep content width for centering */ width: 250px;
} }

View File

@ -9,9 +9,11 @@
</div> </div>
<script> <script>
// slide the sidebar to the left instead of default up
document.getElementById('toggleSidebarButton').addEventListener('click', function () { document.getElementById('toggleSidebarButton').addEventListener('click', function () {
document.getElementById('sidebar').classList.toggle('collapsed'); document.getElementById('sidebar').classList.toggle('collapsed');
}); });
</script> </script>
</body> </body>

View File

@ -5,7 +5,6 @@
<button class="btn btn-primary mb-3" type="button" id="toggleSidebarButton"> <button class="btn btn-primary mb-3" type="button" id="toggleSidebarButton">
sidebar sidebar
</button> </button>
<li><a href="index.php">home</a></li> <li><a href="index.php">home</a></li>
<?php if ( isset($_SESSION['username']) ) { ?> <?php if ( isset($_SESSION['username']) ) { ?>
<li><a href="?page=config">config</a></li> <li><a href="?page=config">config</a></li>

View File

@ -13,6 +13,6 @@
<!-- /Sidebar --> <!-- /Sidebar -->
<div class="col-md-9"> <div class="col-md-9" id="main-content">
<!-- Main content --> <!-- Main content -->