Here is what we're going to build:
- #1 Basic sidebar: Static collapsible Bootstrap sidebar menu
- #2 Basic sidebar: Fixed & collapsible Bootstrap sidebar navigation
- #3 Advanced sidebar: Fixed scrollable & collapsible Bootstrap sidebar with page transparent overlay
- #4 Advanced sidebar: Partially collapsing static sidebar (i.e. the sidebar will not collapse fully but to a compressed state)
- Bonus section: Further Improvements - Fancy animated button and 3D animated sidebar
Demos :
Before we dig into coding, we should first set up our workflow with the necessary files.
In all four cases we'll go through today, we will need Bootstrap CSS and JS files, jQuery library, and our custom stylesheet.
So, our startup markup should be as following:
<html !DOCTYPE>
<head>
<title>Bootstrap 3 Collapsible Sidebar</title>
<!-- Bootstrap CSS CDN -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- Our Custom CSS -->
<link rel="stylesheet" href="css/custom.css">
</head>
<body>
<!-- jQuery CDN -->
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<!-- Bootstrap Js CDN -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>