With Twitter Bootstrap 2, how do get links working within collapse-nav:
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="/index.html">Hubsphere - Controller</a>
<div class="nav-collapse">
<ul class="nav">
<li class="">
<a href="./index.html">Overview</a>
</li>
</ul>
</div>
</div>
</div>
</div>
i have jquery included, and the bootstrap-collapse.js file.
I have tried calling $('.nav-collapse').collapse()
but this just opens the collapse area and dose not activate the button. which is what i expected as it should just work with markup.
thanks
To create a collapsible navigation bar, use a button with class="navbar-toggler", data-toggle="collapse" and data-target="#thetarget" . Then wrap the navbar content (links, etc) inside a div element with class="collapse navbar-collapse" , followed by an id that matches the data-target of the button: "thetarget".
Introduction to Bootstrap Collapse Navbar. Navigation bar (Navbar) is a header or index of the web application. It is always placed on top of the web page. The collapse in bootstrap is used for space-saving of large content. It is hidden and shows the content when the user wants.
Wrap both #nabar-mid-collapse and #navbar-rt-collapse in a div with class row-fluid , and apply class col-xs-4 (*or any respective . col class according to the width you need for each item *) to both of them. There is no row-fluid in Bootstrap 3.
Navbar Toggle Label Bootstrap Navbar component is designed for mobile first approach. Therefore, the navbar renders as collapsed on mobile devices. It can be toggled by a hamburger button. Unfortunately, hamburger icons are proved to be less efficient and not very usable. Navbar Toggle component extends the default .
I was a bit curious to see if this problem still occurs with bootstrap 2.0.4
In fact, it makes no sense to include both bootstrap.js and bootstrap-collapse.js since bootstrap.js includes bootstrap-collapse.js
only boostrap-collapse.js http://jsfiddle.net/baptme/YWUmb/6/
It works pefectly fine as expected.
both boostrap.js & boostrap-collapse.js: http://jsfiddle.net/baptme/YWUmb/5/
If you click on the collapse button for the first time, the div opens and closes immediately. (I think it's because the plugin is declared twice).
And then it works ok.
This issue is specific to the early version of twitter boostrap (2.0.0) but it has been dealt with or no longer occuring due to a change in the plugin structure.
Ok so my problem was that i was including bootstrap.js and the bootstrap-collapse.js in the same file, i assumed that bootstrap.js was needed, and then when it did not work i included bootstrap-collapse.js.
It is now obvious to me, but bootstrap.js is all the bootstrap js rolled up. Which is nice...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With