Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Foundation 5: Dropdown content not working

I am trying content dropdown from Foundation 5: http://foundation.zurb.com/docs/components/dropdown.html, but it does not work as you can see on this fiddle: http://jsfiddle.net/AQGd9/2/. Basically, the content does not appear upon clicking the link when it should.

<a href="#" data-dropdown="drop2">Has Content Dropdown</a>
    <ul id="drop2" class="f-dropdown content" data-dropdown-content>
      <li><a href="#">This is a link</a></li>
      <li><a href="#">This is another</a></li>
      <li><a href="#">Yet another</a></li>
    </ul>

Thanks

like image 763
francoisrv Avatar asked Dec 25 '22 17:12

francoisrv


2 Answers

You need to explicitly initialize foundation with this piece of code before the end of your body, like this:

<body>
  ...
  <script>
    $(document).foundation();
  </script>
</body>
like image 133
user292595 Avatar answered Mar 31 '23 22:03

user292595


I have the same problem right now. The doc says that you need include the javascript required files, there are two ways to do it:

1) All Js (core + plugins): foundation.min.js

2) Only the core, and add the plugins on demand: foundation.js + foundation.dropdown.js (in this case).

So, launch foundation Js:

$(document).foundation();

Source: Foundation 5 Js Doc

This work for me.

like image 26
ramiromd Avatar answered Mar 31 '23 21:03

ramiromd