Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown in Topbar #68

Closed
acmngmbh opened this issue Aug 23, 2011 · 2 comments
Closed

Dropdown in Topbar #68

acmngmbh opened this issue Aug 23, 2011 · 2 comments

Comments

@acmngmbh
Copy link

If I add a dropdown menu to a top navigation bar, the dropdown function is not working... Sample:

<div class="topbar">
  <div class="fill">
    <div class="container">
      <h3><a href="#">Bootstrap</a></h3>

      <ul>
        <li class="active"><a href="#masthead">Overview</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#grid-system">Grid</a></li>
        <li><a href="#layouts">Layouts</a></li>
        <li><a href="#typography">Typography</a></li>

        <li><a href="#tables">Tables</a></li>
        <li><a href="#forms">Forms</a></li>
        <li><a href="#navigation">Navigation</a></li>
        <li><a href="#alerts">Alerts</a></li>
        <li><a href="#popovers">Popovers</a></li>
        <li><a href="#less">Less</a></li>
      </ul>

        <ul class="nav secondary-nav">
        <li class="menu">
          <a href="#" class="menu">Dropdown</a>
          <ul class="menu-dropdown">

            <li><a href="#">Secondary link</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Another link</a></li>
          </ul>
        </li>
      </ul>

    </div>
  </div>
</div>

Is there something wrong in my code?

@fat
Copy link
Member

fat commented Aug 23, 2011

You need javascript to make the dropdown work. To show and hide the menu-dropdown element just toggle the open class on li.menu.

@fat fat closed this as completed Aug 23, 2011
@maddyblue
Copy link

From http://twitter.github.com/bootstrap/assets/js/application.js:

  // Dropdown example for topbar nav
  // ===============================

  $("body").bind("click", function (e) {
    $('.dropdown-toggle, .menu').parent("li").removeClass("open");
  });
  $(".dropdown-toggle, .menu").click(function (e) {
    var $li = $(this).parent("li").toggleClass('open');
    return false;
  });

sengeezer referenced this issue in sengeezer/sass-twitter-bootstrap May 5, 2013
cvrebert added a commit that referenced this issue May 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants