基礎 - 基本下拉窗格



描述

它用於建立下拉窗格,以便從列表中選擇值。

例子

以下示例演示了在 Foundation 中使用基本下拉窗格

<!doctype html>
   <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>Dropdown Pane</title>

      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.1/dist/css/foundation.min.css" crossorigin="anonymous">

      <!-- Compressed JavaScript -->
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>

      <script src="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.1/dist/js/foundation.min.js" crossorigin="anonymous"></script>
   </head>

   <body>
      <h2>Dropdown Pane Example</h2>
      <button class = "button" type =" button" data-toggle = "dropdown_toggle">Basic Dropdown Pane</button>

      <div class = "dropdown-pane" id = "dropdown_toggle" data-dropdown>
         Foundation is a responsive front-end framework.
      </div>
      <button class = "button" type = "button" data-toggle = "dropdown_toggle1">
         Hoverable Dropdown Pane
      </button>

      <div class = "dropdown-pane" id = "dropdown_toggle1" data-dropdown data-hover  = "true">
         Foundation is a responsive front-end framework.
      </div>

      <script>
         $(document).ready(function() {
            $(document).foundation();
         })
      </script>
   </body>
</html>

輸出

讓我們按照以下步驟檢視上述程式碼如何工作 −

  • 將以上給出的 html 程式碼儲存到basic_dropdown_pane.html 檔案中。

  • 在瀏覽器中開啟此 HTML 檔案,顯示的輸出如下所示。

foundation_containers.htm
廣告