- Foundation 通用
- 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 Mixin
- Foundation 庫
- Foundation - Motion UI
- Foundation 有用資源
- Foundation - 簡明指南
- Foundation - 有用資源
- Foundation - 討論
Foundation - 無線電開關
說明
無線電開關用於從許多選項中選擇一個選項。可以使用<input type = "radio">來建立選項列表。
示例
以下示例演示如何在 Foundation 中使用無線電開關。
<html>
<head>
<title>Radio Switch</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>
<div>
<div class = "switch">
<input class = "switch-input" id = "exampleRadioSwitch1" type = "radio" checked name = "testGroup">
<label class = "switch-paddle" for = "exampleRadioSwitch1">
<span class = "show-for-sr">Radio Switch 1</span>
</label>
</div>
<div class = "switch">
<input class = "switch-input" id = "exampleRadioSwitch2" type = "radio" checked name = "testGroup">
<label class = "switch-paddle" for = "exampleRadioSwitch2">
<span class = "show-for-sr">Radio Switch 2</span>
</label>
</div>
<div class = "switch">
<input class = "switch-input" id = "exampleRadioSwitch3" type = "radio" checked name = "testGroup">
<label class = "switch-paddle" for = "exampleRadioSwitch3">
<span class = "show-for-sr">Radio Switch 3</span>
</label>
</div>
</div>
<script>
$(document).ready(function() {
$(document).foundation();
})
</script>
</body>
</html>
輸出
讓我們執行以下步驟,瞭解上述程式碼如何工作 -
儲存上述給出的 html 程式碼radio_switch.html檔案。
在瀏覽器中開啟此 HTML 檔案,將顯示如下所示的輸出。
foundation_basic_controls.htm
廣告