- Foundation General
- Foundation - 全域性樣式
- Foundation - Sass
- Foundation - JavaScript
- Foundation - JavaScript 實用程式
- Foundation - 媒體查詢
- Foundation - 網格
- Foundation - 靈活網格
- Foundation - 表單
- Foundation - 可見性類
- Foundation - 基本字型排印
- Foundation - 排版輔助工具
- Foundation - 基本控制元件
- Foundation - 導航
- Foundation - 容器
- Foundation - 媒體
- Foundation - 外掛
- Foundation SASS
- Foundation - Sass 函式
- Foundation - Sass 混合
- Foundation 庫
- Foundation - Motion UI
- Foundation 有用資源
- Foundation - 快速指南
- Foundation - 有用資源
- Foundation - 討論
Foundation - 內部標籤
描述
您可以使用內部標籤顯示處於活動和非活動狀態的開關文字。.switch-active 用於表示開關處於開啟狀態,.switch-inactive 用於表示開關處於關閉狀態。活動/非活動文字包含在開關的 <lable> 中。
示例
以下示例演示了在 Foundation 中使用 內部開關標籤。
<html>
<head>
<title>Inner Labels</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>
<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>
$(document).ready(function() {
$(document).foundation();
})
</script>
</body>
</html>
輸出
讓我們執行以下步驟,瞭解上面給出的程式碼是如何工作的 -
將上述給出的 HTML 程式碼儲存在 inner_labels.html 檔案中。
在瀏覽器中開啟此 HTML 檔案,如下所示顯示輸出。
foundation_basic_controls.htm
廣告