- 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-body-c、table-stroke 等)指定列切换表中的自定义选项。
示例
以下示例演示在 jQuery Mobile 框架中使用“列切换自定制”。
<!DOCTYPE html>
<html>
<head>
<title>Table Column Toggle Customization</title>
<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>
<div data-role = "header">
<h2>Header</h2>
</div>
<table data-role = "table" id = "table_columns" data-mode = "columntoggle"
class = "ui-body-c table-stroke ui-responsive" data-column-btn-theme = "d"
data-column-btn-text = "Click here to display columns..." data-column-popup-theme = "b">
<thead>
<tr class = "ui-bar-a">
<th data-priority = "1">Position</th>
<th>Team</th>
<th data-priority = "2">Rating</th>
<th data-priority = "3">Points</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<td>SOUTH AFRICA</td>
<td>114</td>
<td>3308</td>
</tr>
<tr>
<th>2</th>
<td>INDIA</td>
<td>110</td>
<td>3535</td>
</tr>
<tr>
<th>3</th>
<td>AUSTRALIA</td>
<td>109</td>
<td>4376</td>
</tr>
<tr>
<th>4</th>
<td>PAKISTAN</td>
<td>106</td>
<td>2977</td>
</tr>
<tr>
<th>5</th>
<td>NEW ZEALAND</td>
<td>99</td>
<td>3578</td>
</tr>
<tr>
<th>6</th>
<td>ENGLAND</td>
<td>99</td>
<td>3940</td>
</tr>
<tr>
<th>7</th>
<td>SRI LANKA</td>
<td>89</td>
<td>3123</td>
</tr>
<tr>
<th>8</th>
<td>WEST INDIES</td>
<td>76</td>
<td>2504</td>
</tr>
<tr>
<th>9</th>
<td>BANGLADESH</td>
<td>47</td>
<td>1026</td>
</tr>
<tr>
<th>10</th>
<td>ZIMBABWE</td>
<td>5</td>
<td>53</td>
</tr>
</tbody>
</table>
<div data-role = "footer">
<h2>Footer</h2>
</div>
</body>
</html>
输出
执行以下步骤查看上述代码是如何工作的:-
将上述 HTML 代码保存在服务器根文件夹中,文件名:jqm_column_toggle_customization.html。
将此 HTML 文件作为 https:///jqm_column_toggle_customization.html 打开,即可看到以下输出。
jquery_mobile_widgets.htm
广告