'Navbar fixed left - Bootstrap
I am trying to make navbar in bootstrap to be fixed left, like on this link. Anyway, it is working, but when I add block content of the leaflet map, my navbar is still there, but I can't click on it. Also, I don't get pointer mouse when I cross over the link. Here is code which I changed:
<!--NAVBAR-->
<div class="navbar navbar-inverse navbar-fixed-left">
<a class="navbar-brand" href="#">Brand</a>
<ul class="nav navbar-nav">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Sub Menu1</a></li>
<li><a href="#">Sub Menu2</a></li>
<li><a href="#">Sub Menu3</a></li>
<li class="divider"></li>
<li><a href="#">Sub Menu4</a></li>
<li><a href="#">Sub Menu5</a></li>
</ul>
</li>
<li><a href="#">Link2</a></li>
<li><a href="#">Link3</a></li>
<li><a href="#">Link4</a></li>
<li><a href="#">Link5</a></li>
</ul>
</div>
</div>
<div class="container col-sm-12">
<div class="row">
{% block map_content %}
replace me
{% endblock map_content %}
</div>
</div>
Before this, I tried more elegant solution. I used bootstrap4 and tried something like this:
<nav class="navbar navbar-inverse fixed-left">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="{% url 'index' %}"><p class="logo_name">page name</p></a>
</div>
<ul class="nav navbar-nav">
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
</ul>
</div>
</nav>
But it doesn't work, in this case, my navbar is fixed top, and not left.
Solution 1:[1]
try adding these things. Add extra CSS to modify existing class.
Add this extra css:-
<style>
.navbar-fixed-left {
width: 140px;
position: fixed;
border-radius: 0;
height: 100%;
}
.navbar-fixed-left .navbar-nav > li {
float: none; /* Cancel default li float: left */
width: 139px;
}
.navbar-fixed-left + .container {
padding-left: 160px;
}
/* On using dropdown menu (To right shift popuped) */
.navbar-fixed-left .navbar-nav > li > .dropdown-menu {
margin-top: -50px;
margin-left: 140px;
}
</style>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Riwaj Chalise |