在Foundation 6菜单中使用图标

时间:2018-01-29 10:07:06

标签: icons zurb-foundation-6

我为网站创建了一个简单的F6应用,并尝试将代码段复制粘贴到带有图标的显示菜单中。为什么id doe既不在topbar菜单中也不在off-canvas菜单部分中?这是HTML代码:

<!doctype html>
<html class="no-js" lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>FDashboard</title>
    <link rel="stylesheet" href="css/app.css">
  </head>
  <body>
    <div class="title-bar" data-responsive-toggle="responsive-menu" data-hide-for="medium">
      <button class="menu-icon" type="button" data-toggle="responsive-menu"></button>
      <div class="title-bar-title">Menu</div>
    </div>

    <div class="top-bar" id="responsive-menu">
      <div class="top-bar-left">
        <ul class="dropdown menu" data-dropdown-menu>
          <li class="menu-text">Site Title</li>
          <li class="has-submenu">
            <a href="#0">One</a>
            <ul class="submenu menu vertical" data-submenu>
              <li><a href="#0">One</a></li>
              <li><a href="#0">Two</a></li>
              <li><a href="#0">Three</a></li>
            </ul>
          </li>
          <li><a href="#0">Two</a></li>
          <li><a href="#"><span>Three</span> <i class="fi-list"></i></a></li>
        </ul>
      </div>
      <div class="top-bar-right">
        <ul class="menu">
          <li><input type="search" placeholder="Search"></li>
          <li><button type="button" class="button">Search</button></li>
        </ul>
      </div>
    </div>

    <div class="off-canvas-wrapper">
      <button type="button" class="button" data-toggle="offCanvas">Open Menu</button>
      <div class="off-canvas position-left" id="offCanvas" data-off-canvas>

        <!-- Your menu or Off-canvas content goes here -->

            <!-- Menu -->
        <ul class="vertical menu icons icon-left">
          <li><a href="#"><i class="fi-list"></i> <span>One</span></a></li>
          <li><a href="#"><i class="fi-list"></i> <span>Two</span></a></li>
          <li><a href="#"><i class="fi-list"></i> <span>Three</span></a></li>
          <li><a href="#"><i class="fi-list"></i> <span>Four</span></a></li>
        </ul>
      </div>

      <div class="off-canvas-content" data-off-canvas-content>
        <!-- Your page content lives here -->
        <div class="grid-container">
          <div class="grid-x grid-padding-x">
            <div class="large-12 cell">
              <h1>Welcome to Foundation</h1>
            </div>
          </div>
        </div>
      </div>

    </div>


    <script src="bower_components/jquery/dist/jquery.js"></script>
    <script src="bower_components/what-input/dist/what-input.js"></script>
    <script src="bower_components/foundation-sites/dist/js/foundation.js"></script>
    <script src="js/app.js"></script>
  </body>
</html>

将以下行添加到app.scss还没有解决问题:

@include menu-base;
@include menu-expand;
@include menu-align;
@include menu-direction($dir);
@include menu-icon-position;
@include menu-icons;
@include menu-icon-position;

这里有什么问题?谢谢!

1 个答案:

答案 0 :(得分:0)

我不确定它是最好和最合适的解决方案。无论如何,它工作正常。所以,如果有更好的方法,它总是受欢迎的。所描述的步骤是针对使用Foundation CLI创建的F6项目进行的。

  1. 下载Foundation Icon Fonts 3

  2. 解压缩下载的存档并将其全部内容复制到[your-project]/css文件夹中。

  3. 删除preview.html文件(无用,仅用于显示可用图标)。
  4. 在HTML页面中引用图标CSS文件,如下所示<link rel="stylesheet" href="css/foundation-icons/foundation-icons.css" />。您可以在项目创建期间生成<link rel="stylesheet" href="css/app.css">行。
  5. 使用其中一个图标字体,例如: <li><a href="#"><span>Three</span> <i class="fi-list"></i></a></li>
  6. 享受:)