Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Foundation Zurb dropdown not working

I just downloaded the Foundation 5 CSS framework and copied the code for the tutorial but the dropdown doesn't seem to work, as well as the menu in "mobile" view.

my code:

<html>
<head>
   <link rel="stylesheet" href="css/foundation.css" />
   <script src="js/vendor/modernizr.js"></script>
   <script src="js/vendor/jquery.js"></script>
   <script src="js/foundation/foundation.js"></script>
   <script src="js/foundation/foundation.dropdown.js"></script>
   <script src="js/foundation/foundation.topbar.js"></script>
   <script> $(document).foundation(); </script>
</head>

<body>
<!-- header -->
<nav class="top-bar" data-topbar>
  <ul class="title-area">
    <li class="name">
      <h1><a href="#">My Site</a></h1>
    </li>
    <li class="toggle-topbar menu-icon"><a href="#">Menu</a></li>
  </ul>

  <section class="top-bar-section">
    <!-- Right Nav Section -->
    <ul class="right">
      <li class="active"><a href="#">Right Button Active</a></li>
      <li class="has-dropdown">
        <a href="#">Right Button Dropdown</a>
        <ul class="dropdown">
          <li><a href="#">First link in dropdown</a></li>
        </ul>
      </li>
    </ul>

    <!-- Left Nav Section -->
    <ul class="left">
      <li><a href="#">Left Nav Button</a></li>
    </ul>
  </section>
</nav>

</body>
</html>

Anyone got any idea why it's not working?

like image 242
GenericUser Avatar asked Apr 03 '14 22:04

GenericUser


1 Answers

Try moving the code below from the header and into the body:

    <script>
        $(document).foundation();
    </script>
like image 138
woany Avatar answered Nov 19 '22 00:11

woany