Foundation - 分割按鈕



說明

要建立分割按鈕,必須新增 .arrow-only 類並建立兩個按鈕的按鈕組。您必須使用 .show-for-sr 對螢幕閱讀器使用標籤。

示例

以下示例演示瞭如何在 Foundation 中使用 分割按鈕

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

      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/foundicons/3.0.0/foundation-icons.css">
   </head>

   <body>
      <div class = "button-group">
         <a class = "button">Shut Down</a>
         <a class = "dropdown button arrow-only"><span class = "show-for-sr">Show options</span></a>
      </div>

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

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

輸出

讓我們執行以下步驟以瞭解上述給定程式碼如何工作的 -

  • 儲存上面給定的 html 程式碼 button_split.html 檔案。

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

foundation_basic_controls.htm
廣告
© . All rights reserved.