Inner Labels

优质
小牛编辑
129浏览
2023-12-01

描述 (Description)

您可以使用内部标签显示活动和非活动开关文本。 .switch-active用于指示交换机已打开,而.switch-inactive用于指示交换机已关闭。 活动/非活动文本包含在交换机的《label》中。

例子 (Example)

以下示例演示了在Foundation中使用inner label for switch

<html>
   <head>
      <title>Inner Labels</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/css/foundation.css">
   </head>
   <body>
      <p>Would you like to follow us?</p>
      <div class = "switch large">
         <input class = "switch-input" id = "inner_label" type = "checkbox" name = "demoSwitch">
         <label class = "switch-paddle" for = "inner_label">
            <span class = "show-for-sr">Would you like to follow us?</span>
            <span class = "switch-active" aria-hidden = "true">Yes</span>
            <span class = "switch-inactive" aria-hidden = "true">No</span>
         </label>
      </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>