Bootstrap 3 : what to do if click one nav bar open only that clicked

I use Bootstrap 3
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

but when implemented fixed position Nav bar top and fixed bottom THEN when open one nav bar on tablet or phone (shrink-ed) open and the other… what to do if click one nav bar open **only **that clicked???

    <body>
    <div class="header">  
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header" style="padding-left:15px">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="index.html">XYZ.COM Mobile App</a>
    </div>
    <div class="collapse navbar-collapse">
      <ul class="nav navbar-nav">
        <li><a href="index.html">Home</a></li>
        <li><a href="login-register.html">Login/Register</a></li>
        <li><a href="search.html">Search Honda Cars</a></li>
        <li><a href="view.html">Lastest Honda Cars</a></li>
        <li><a href="add.html">Add a Car</a></li>
      </ul>
    </div><!--/.nav-collapse -->
  </div>
</div>
    </div>   
    <div class="container">

    <div class="header">
        <div class="row">
            <div class="col-xs-12 text-center">
                <h3>Home Honda Cars - Promo Hondas</h3>
            </div>
        </div>
    </div>

    <div class="row" id="dataDiv">
        <div id="refresh">
            <div class="alert" role="alert" id="no-search-message">
                <strong>Car Listing here...</strong>
            </div>
    			</div>
    </div>
    
    <div class="footer">
        <div class="row">
                <div class="col-xs-12 col-md-12 text-center">
                        <h5>(c) 2015  - XYZ.com</h5>
                </div>
        </div>
    </div>
    </div>
    <div class="footer">    
    <div class="navbar navbar-inverse navbar-fixed-bottom" role="navigation">
  <div class="container">
    <div class="navbar-header" style="padding-left:15px">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="index.html">XYZ.COM Mobile App</a>
    </div>
    <div class="collapse navbar-collapse">
      <ul class="nav navbar-nav">
        <li><a href="index.html">Home</a></li>
        <li><a href="login-register.html">Login/Register</a></li>
        <li><a href="search.html">Search Honda Cars</a></li>
        <li><a href="view.html">Lastest Honda Cars</a></li>
        <li><a href="add.html">Add a Car</a></li>
      </ul>
    </div><!--/.nav-collapse -->
  </div>     

    </div>
    </div>

      <script type="text/javascript" src="js/main.js"></script>

    </body>

SEE APP - CLICKED ON A NAV BAR OPENED BOTH

Try a unique ID on each of the class - navbar elements? Or maybe there is a data- element that will allow the script to differentiate between the two.

you mean change html only or and js??

I have a feeling it doesn’t know how to tell the difference between those two instances of the dropdown you have. If each dropdown/menu had its own id=unique_name, it should be able to get back to the instance that triggered it.

Add id=“first_menu” to the first one of those, and id=“second_menu” to the second one.

You shouldn’t have to do anything to any JS code.

Or I could be completely wrong

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.