在顶栏中有基础下拉菜单的问题

时间:2018-02-10 08:38:29

标签: javascript css django drop-down-menu zurb-foundation

我用yarn或npm安装基础网站。所以我在node_modules / foundation-sites中有源代码。我使用django但没有它我有同样的问题

这是我的index.html:

{% load static %}
{% load sass_tags %}
<!DOCTYPE html>
<html lang="fr">
  <head>
    <meta charset="utf-8">
    <title>short url</title>
    {% load compress %}
    {% compress css %}
      <link href="{% sass_src 'scss/style.scss' %}" rel="stylesheet" type="text/css" />
    {% endcompress %}
  </head>
  <body>
    <div class="top-bar">
      <div class="top-bar-left">
        <ul class="dropdown menu" data-dropdown-menu>
          <li class="menu-text">shorturl</li>
          <li><a href="/shorturl">Racine</a></li>
          <li><a href="/shorturl/url_list">url list</a></li>
          <li>
            <a href="http://www.perdu.com">perdu</a>
            <ul class="menu vertical">
              <li><a href="#">Lien 1</a></li>
              <li><a href="#">Lien 2</a></li>
            </ul>
          </li>
        </ul>
      </div>
    </div>

    {% block content %}
    {% endblock %}

      <script src="{% static "js/jquery/dist/jquery.js" %}"></script>
      <script src="{% static "js/what-input/dist/what-input.js" %}"></script>
      <script src="{% static "js/foundation-sites/dist/js/foundation.js" %}"></script>
      <script src="{% static "js/foundation-sites/dist/js/plugins/foundation.core.js" %}"></script>
      <script src="{% static "js/foundation-sites/dist/js/plugins/foundation.dropdown.js" %}"></script>
      <script src="{% static "js/foundation-sites/dist/js/plugins/foundation.dropdownMenu.js" %}"></script>
      <script src="{% static "js/foundation-sites/dist/js/plugins/foundation.util.keyboard.js" %}"></script>
      <script src="{% static "js/foundation-sites/dist/js/plugins/foundation.util.box.js" %}"></script>
      <script src="{% static "js/foundation-sites/dist/js/plugins/foundation.util.nest.js" %}"></script>
      <script src="{% static "js/app.js" %}"></script>
  </body>
</html>

当我加载网页时,我有:issue with dropdown menu

有人有想法解决它吗?

感谢您的帮助

1 个答案:

答案 0 :(得分:0)

我的js / app.js中有一个错误。

我忘了()最后初始化基础。所以我说这个:

$(document).foundation();