
- 通用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 - 自定義控制元件
說明
日期選取器、開關或滑塊等自定義控制元件需要一些注意才能訪問它。帶有標籤的幫助文字或自定義輸入,需要向其中新增_aria-labelledby_和_aria-describedby_屬性。這將幫助螢幕閱讀器描述控制元件。
示例
以下示例演示了在Foundation中使用_自定義控制元件_。
<html> <head> <title>Form Custom Controls</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> <form> <label id = "rateLabel">Rate Yourself</label> <div class = "slider" aria-labelledby = "rateLabel" aria-describedby = "rateHelpText" data-slider data-initial-start = '80' data-end = '100'> <span class = "slider-handle" data-slider-handle role = "slider" tabindex = "1"></span> <span class = "slider-fill" data-slider-fill></span> <input type = "hidden"> </div> <p id = "rateHelpText">how good are you at problem solving?</p> </form> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
輸出
讓我們執行以下步驟,瞭解上面給出的程式碼是如何工作的 -
儲存上面給出的html程式碼**form_custom_controls.html**檔案。
在瀏覽器中開啟此HTML檔案,顯示的輸出如下。
foundation_forms.htm
廣告