- 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-collapsed 屬性設定為 false,可以展開可摺疊內容。
示例
以下示例演示了在 jQuery Mobile 中使用 展開的可摺疊內容。
<!DOCTYPE html>
<html>
<head>
<title>Collapsible Expanded</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 = "collapsible" data-collapsed = "false">
<h4>Heading</h4>
<ul data-role = "listview">
<li><a href = "#">Item 1</a></li>
<li><a href = "#">Item 2</a></li>
<li><a href = "#">Item 3</a></li>
</ul>
</div>
</body>
</html>
輸出
讓我們執行以下步驟來了解上述程式碼如何工作 −
將以上 html 程式碼作為 collapsible_expanded.html 檔案儲存在伺服器根資料夾中。
以 https:///collapsible_expanded.html 形式開啟此 HTML 檔案,將顯示以下輸出。
jquery_mobile_widgets.htm
廣告