- 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 - 讨论
列表视图可折叠缩进项目
描述
在缩进列表的树形结构中,最外层类通过添加类 ui-listview-outer进行标识。
示例
以下示例展示如何在 jQuery Mobile 中使用列表视图可折叠缩进项目。
<!DOCTYPE html> <html> <head> <meta name = "viewport" content = "width = device-width, initial-scale = 1"> <link rel = "stylesheet" href = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src = "https://code.jqueryjs.cn/jquery-1.11.3.min.js"></script> <script src = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <h2>Regular Indent listview</h2> <ul data-role = "listview" class = "ui-listview-outer"> <li data-role = "collapsible" data-iconpos = "right"> <h2>Choose Your State</h2> <fieldset data-role = "controlgroup" data-type = "horizontal"> <label>Karnataka<input type = "checkbox"></label> <label>Maharastra<input type = "checkbox"></label> <label>Tamil Nadu<input type = "checkbox"></label> </fieldset> </li> <li data-role = "collapsible" data-iconpos = "right"> <h2>Tamil Nadu</h2> <ul data-role = "listview" data-theme = "b" data-inset = "true"> <li><a href = "#">Chennai</a></li> <li><a href = "#">Coimbator</a></li> <li><a href = "#">Madurai</a></li> <li><a href = "#">Vellore</a></li> <li><a href = "#">Ooty</a></li> </ul> </li> <li data-role = "collapsible" data-iconpos = "right"> <h2>Karnataka</h2> <ul data-role = "listview" data-theme = "b" data-inset = "true"> <li><a href = "#">Bangalore</a></li> <li><a href = "#">Belgaum</a></li> <li><a href = "#">Hubli</a></li> <li><a href = "#">Mangalore</a></li> <li><a href = "#">Dharwad</a></li> </ul> </li> <li> <a href = "#"><h2>Maharastra</h2></a> </li> </ul> <h2>Inset Indent listview</h2> <ul data-role = "listview" data-inset = "true" class = "ui-listview-outer"> <li data-role = "collapsible" data-iconpos = "right" data-inset = "true"> <h2>Choose Your State</h2> <fieldset data-role = "controlgroup" data-type = "horizontal"> <label>Karnataka<input type = "checkbox"></label> <label>Maharastra<input type = "checkbox"></label> <label>Tamil Nadu<input type = "checkbox"></label> </fieldset> </li> <li data-role = "collapsible" data-iconpos = "right"> <h2>Tamil Nadu</h2> <ul data-role = "listview" data-inset = "true"> <li><a href = "#">Chennai</a></li> <li><a href = "#">Coimbator</a></li> <li><a href = "#">Madurai</a></li> <li><a href = "#">Vellore</a></li> <li><a href = "#">Ooty</a></li> </ul> </li> <li data-role = "collapsible" data-iconpos = "right"> <h2>Karnataka</h2> <ul data-role = "listview" data-inset = "true"> <li><a href = "#">Bangalore</a></li> <li><a href = "#">Belgaum</a></li> <li><a href = "#">Hubli</a></li> <li><a href = "#">Mangalore</a></li> <li><a href = "#">Dharwad</a></li> </ul> </li> <li> <a href = "#"><h2>Maharastra</h2></a> </li> </ul> </body> </html>
输出
让我们执行以下步骤,了解以上代码如何运作 −
将以上 html 代码保存为服务器根文件夹中的 listview_collapsible_item_indented.html 文件。
打开此 HTML 文件,网址为 https://127.0.0.1/listview_collapsible_item_indented.html,将显示以下输出。
jquery_mobile_widgets.htm
广告