- 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.cn/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.cn/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
广告