Foundation does not work anything using Javascript

Asked

Viewed 232 times

-1

I’m clicking on the header Jquery, Foundation.min.js and Foundation.css. But nothing that needs Javascript works, such as dropdown, slider, etc. I can’t find a solution anywhere. How to make the Foundation work?

<html>
<head>
    <meta charset="utf-8">
    <title>Test Foundation</title>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <link rel="stylesheet" href="foundation/css/foundation.min.css">
    <script src="foundation/js/foundation.min.js"></script>
</head>
<body>

<div class="row">
<div class="medium-6 columns">

<a href="#" data-dropdown="drop1" class="button dropdown">Dropdown Button</a><br>
<ul id="drop1" data-dropdown-content class="f-dropdown">
<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>

</div>
</div>

</body>
</html>

The button dropdown does not work, although everything is being loaded normally. The code is identical to the documentation.

  • 3

    Could you provide some example?

  • show the part of the code that is not working

  • 1

    Hello, @user7770, Welcome to [en.so], please check out the guides [about] and [Ask]. You can [Edit] your question to include more details.

  • I added an example.

2 answers

1

It seems you forgot to boot Foundation. Put this just before the </body>, and the dropdown will work:

<script>$(document).foundation();</script>

1

Try to place javascript at the bottom of the page before closing the Body tag. Below this you do the Foundation boot:

<script>$(document).foundation();</script>

If it still doesn’t work, include the individual JS dropdown file as it appears in the JS documentation on the Foundation.

<script src="foundation/js/foundation.dropdown.js"></script>

Adjust the file path if necessary.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.