skip to Main Content

My menu does not open on click and cant understand why. Checked alot of posts in stackoverflow and around the web, but still cant figure it out. The question might be pathetic, but i am still newbie in bootstrap.

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>




<header>
  <div class="navbar navbar-default navbar-fixed-top text-uppercase">
    <div class="container">
      <div class="navbar-header">
        <a href="index.html" class="navbar-brand">My Blog</a>

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-targert=".navbar-collapse">
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
      </div>
      <div class="navbar-collapse collapse">
        <ul class="nav navbar-nav navbar-right">
          <li>
            <a href="#">Register</a>
          </li>
          <li>
            <a href="#">Login</a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</header>

<footer></footer>

Will appreciate any advice! Thank you!

2

Answers


  1. here is example of dropdown toggle menu for you:

     <ul class="nav navbar-nav navbar-right">
                    <li class="dropdown profile_menu">
                        <a href="#" data-toggle="dropdown" class="dropdown-toggle"><span>Hello</span><b class="caret"></b></a> 
                        <ul class="dropdown-menu">
                            <li><a href="@Url.Action("Index", "Manage")">My Account</a></li>
                            <li><a href="#">Go to Profile</a></li>
                            <li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li>
                        </ul>
                    </li>
                </ul>
    
    Login or Signup to reply.
  2. You made a typo: it should be “data-target”, not “data-targert” 🙂

    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
    

    After this change, it worked for me!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search