I've been attempting to create a collapsible fixed sidebar, but I'm facing some challenges. Despite searching online for solutions, I haven't been able to find any that work.
Here is the code snippet from my sidebar.html:
<div class="container-fluid" style="background-color:#19334d">
<div class="sidebar" id="sidebar">
<div class="pt-5 text-center pb-2 ">
<a href="../index.php" class="logo-normal pr-3">
<img src='../assets/img/favicon.ico' width="50px">
</a>
<a href="../index.php" class="logo-normal">
Fitness Addict
</a>
</div>
<hr style="border-color:white; width:90%" align=center>
<ul class="nav pl-4">
<li >
<a href="../home/myhome.php">
<i class="fa fa-home icon pr-4"></i>
My Home
</a>
</li>
.
.
.
</ul>
</div>
Below is the CSS used in styling the sidebar:
.sidebar{
height: calc(100vh - 90px);
width: 230px;
position: fixed;
top: 0;
left: 0;
z-index: 1;
background-size: cover;
background-position: center center;
display: block;
background: #408000;
box-shadow: 0px 0px 45px 0px rgba(0, 0, 0, 0.6);
margin-top: 80px;
margin-left: 20px;
border-radius: 5px;
}
.sidebar .nav {
margin-top: 20px;
display: block;
}
I've attempted using JavaScript to achieve the collapsing effect, but I'm struggling with it. If anyone has any suggestions or can offer assistance, please let me know!https://i.sstatic.net/Yck5u.png