humminglion
humminglion

Reputation: 31

bootstrap dropdown menu always showing

The code:

<nav class='secondary-nav container'>
  <ul>
    <li><a href="#">Customer Care</a></li>
    <li class='dropdown'>
      <a href="#" class="dropdown-toggle" data-toggle="dropdown">Home
      <b class='caret'></b>
      </a>
      <ul class='dropdown-menu'>
        <li>
          <a href="#">Google</a>
        </li>
      </ul>
    </li>
    <li><a href="/sign_out">Sign Out</a></li>
  </ul>
</nav>

I have jQuery, bootstrap-dropdown.js, and bootstrap.css incuded. jQuery is included before everything.

The dropdown menu is appearing by default before a mouse click or hover on the list element.

screenshot - http://cl.ly/image/41122D2Z3R38

Anyone know why?

Thanks!

Upvotes: 0

Views: 2641

Answers (2)

Mahdi Abdi
Mahdi Abdi

Reputation: 692

Try This :

$('.dropdown-toggle').dropdown();

Upvotes: 1

Saif Lacrimosa
Saif Lacrimosa

Reputation: 35

The thing without your css code we can not understand your problem. But as I can see, you data attribute is correctly used, but are you linking you javascript files correctly?

"bootsrtap.js" and "Your jquery File"

The second thing look out on your javascript applying code. The applying code of the nav menu of bootsrtap is :

$('.dropdown-toggle').dropdown();

try to revise your file codes and I think this will help you ^_^

Upvotes: 0

Related Questions