Attempting to create a switchable sidebar (toggling between short and long form) using bootstrap, multiple examples, and online resources.
The width of the sidebar changes when toggled, and I want the content to appear next to it regardless of its length.
Each page is divided into sections, and I aim for each section to display full-width on the screen similar to this.
$(document).ready(function() {
$("#sidebarCollapse").click(function() {
$("#sidebar").toggleClass("active");
$(this).toggleClass('active');
});
});
$("#aboutbutton").click(function() {
$('html, body').animate({
scrollTop: $("#aboutDiv").offset().top
}, 2000);
});
body {
font-family: 'Poppins', sans-serif;
background: #fafafa;
}
p {
font-family: 'Poppins', sans-serif;
font-size: 0.1em;
font-weight: 300;
line-height: 1.7em;
color: #3498db;
}
a,
a:hover,
a:focus {
color: inherit!important;
text-decoration: none!important;
transition: all 0.3s;
}
.wrapper {
display: flex;
}
/* Other CSS code remains unchanged */
<!-- Link and script references remain the same -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>José Gomes - Website</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<!-- Material Design Bootstrap -->
<link rel="stylesheet" href="css/mdb.min.css">
<!-- Scrollbar Custom CSS -->
<link rel="stylesheet" href="css/jquery.mCustomScrollbar.css">
<!-- Our Custom CSS -->
<link rel="stylesheet" href="css/custom.css">
<!-- in your header -->
<link rel="stylesheet" href="https://cdn.rawgit.com/konpa/devicon/df6431e323547add1b4cf45992913f15286456d3/devicon.min.css">
</head>
<body>
<!-- Content will go here -->
<div class="wrapper">
<nav class="sidebar-nav" data-spy="affix" id="sidebar">
<!-- Sidebar HTML structure remains the same -->
</nav>
</div>
<!-- Page Content -->
<div id="content container-fluid p-0">
<!-- Div containing sections with content, dividers, etc. -->
</div>
</div>
Link to the jsfiddle example
Tried using a content wrapper and adjusting margin for the content class but still facing issues with the content appearing below or inside the sidebar.