Two Bootstrap navigation menus simultaneously

I like to know if it is possible to have two navigators at the same time.

Here is a JSFiddle with a bootstrap test with only JavaScript collapse for the navigator. Both menus expand at the same time, is there any way to prevent this?

+6
source share
1 answer

You can, all you have to do is distinguish the data-target attribute with a unique class or identifier for the dropdown menus, for example:

For your first drop down menu

 <a class="btn btn-navbar" data-toggle="collapse" data-target="#first"> 

For your second dropdown:

 <a class="btn btn-navbar" data-toggle="collapse" data-target="#second"> 

Then you can add this unique identifier to the container with the crash navigation:

First

 <div id="first" class="nav-collapse"> ... </div> 

Second

 <div id="second" class="nav-collapse"> ... </div> 

Demo: http://jsfiddle.net/F2tYu/3/

+17
source

Source: https://habr.com/ru/post/917290/


All Articles