- jQuery Mobile 教程
- jQuery Mobile - 主頁
- jQuery Mobile - 概覽
- jQuery Mobile - 設定
- jQuery Mobile - 頁面
- jQuery Mobile - 圖示
- jQuery Mobile - 過渡
- jQuery Mobile - 佈局
- jQuery Mobile - 工具
- jQuery Mobile - 事件
- jQuery Mobile - 表單
- jQuery Mobile - 主題
- jQuery Mobile - CSS 類
- jQuery Mobile - 資料屬性
- jQuery Mobile 有用的資源
- jQuery Mobile - 面試題
- jQuery Mobile - 快速指南
- jQuery Mobile - 有用的資源
- jQuery Mobile - 討論
jQuery Mobile - 可摺疊標記
簡介
可摺疊集合可以使用與基本可摺疊相同的標記來建立。新增data-role="collapsibleset"屬性會使其成為可摺疊集合,並表現得像手風琴。
示例
以下示例演示了在 jQuery Mobile 中使用可摺疊集合。
<!DOCTYPE html>
<html>
<head>
<title>Collapsible Markup</title>
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role = "collapsibleset" data-theme = "a" data-content-theme = "a">
<div data-role = "collapsible">
<h3>Heading 1</h3>
<p>Hi!! This is collapsible content for heading 1</p>
</div>
<div data-role = "collapsible">
<h3>Heading 2</h3>
<p>Hi!! This is collapsible content for heading 2</p>
</div>
<div data-role = "collapsible">
<h3>Heading 3</h3>
<p>Hi!! This is collapsible content for heading 3</p>
</div>
</div>
</body>
</html>
輸出
讓我們執行以下步驟來了解上面程式碼的工作原理:
將上面的 html 程式碼儲存為伺服器根資料夾中的collapsible_markup.html檔案。
將此 HTML 檔案作為 https:///collapsible_markup.html 開啟,將顯示以下輸出。
jquery_mobile_widgets.htm
廣告